Something I realised recently – we've potentially inherited a misunderstanding of Storybook nomenclature from Histoire.
In Storybook the hierarchy is:
Component(s) > Page(s) > Story
Where:
- Component is essentially an item in the navigation tree
- it can render multiple pages, including Docs and Story pages
- each page Story is in effect a instance of the documented component, with different settings.
In other words, there is no "variant" type in Storybook.
I'm guessing Variant is then actually a Histoire-specific mechanism to wire (varied) props to the wrapped component.
This being the case, something like this...

- should really be a
Story not a Variant (with a for-loop of buttons)
- each individual button should be wrapped by a
Variant
In other words, rather than this:
<template>
<Story :layout="{ type: 'grid', width: '250' }">
...
<Variant title="size">
<div v-for="size in sizes" :key="size" class="mb-4">
<UiButton :size="size" :label="`${size} button`" icon="i-heroicons-light-bulb" />
</div>
</Variant>
It should be:
<template>
...
<Story title="size">
<Variant v-for="size in sizes" :key="size">
<UiButton :size="size" :label="`${size} button`" icon="i-heroicons-light-bulb" />
</Variant>
</Story>
<Story title="color">
...
</Story>
Treating variants like this would give us other benefits:
- we could better target code to copy, as a Variant should only ever hold a single component
- we could more easily annotate actual variants like
- we could more easily format text in a Story, as it would always be within a story but never in a Variant
For example:
<Story title="variant shortcuts">
<p>Buttons provide shortcut boolean props to quickly set a variant</p>
<Variant desc="Ghost button shortcut">
<UiButton label="solid" solid />
</Variant>
<Variant desc="Solid button shortcut">
<UiButton label="ghost" ghost />
</Variant>
</Story>
I don't know how we would style all this, but it would certainly give us more structure and more easily target specific examples.
Anyway, I just wanted to mention it whilst it was fresh in my head.
Something I realised recently – we've potentially inherited a misunderstanding of Storybook nomenclature from Histoire.
In Storybook the hierarchy is:
Where:
In other words, there is no "variant" type in Storybook.
I'm guessing Variant is then actually a Histoire-specific mechanism to wire (varied) props to the wrapped component.
This being the case, something like this...
Storynot aVariant(with a for-loop of buttons)VariantIn other words, rather than this:
It should be:
Treating variants like this would give us other benefits:
For example:
I don't know how we would style all this, but it would certainly give us more structure and more easily target specific examples.
Anyway, I just wanted to mention it whilst it was fresh in my head.