Sorry, but you either have no stories or none are selected somehow.
If the problem persists, check the browser console, or the terminal you've run Storybook from.
Using @geometricpanda/storybook-addon-badges
you're able to add badges to
your Storybook app.
NPM:
Yarn:
In your .storybook/main.js
you'll need to load @geometricpanda/storybook-addon-badges
into Storybook:
Optionally, you can define custom badge styles in .storybook/preview.js
.
Optionally, you can define more complex tooltips for any of your badges.
The key for each badge will be what's used throughout storybook to invoke that badge.
I tend to define each key as an enum
when using TypeScript, or even an Object
in plain JavaScript
to avoid using magic strings.
Don't worry if you haven't defined a badge which you use later, any badges which aren't recognised fall back to the default preconfigured grey.
Tip: If you prefer, instead of using the addParameters
function, you can also
export const parameters
containing a full parameters object.
You can import a collection of preconfigured badges using the following import:
You can then use these badges by passing in the following enum values:
BADGE.DEFAULT
BADGE.BETA
BADGE.STABLE
BADGE.DEPRECATED
BADGE.EXPERIMENTAL
BADGE.NEEDS_REVISION
BADGE.OBSOLETE
Should you wish to override these styles you can do by configuring a badge with the same key:
Valid options for the styles
configuration are:
backgroundColor
borderColor
borderRadius
borderStyle
borderWidth
color
fontSize
fontFamily
fontWeight
lineHeight
textTransform
paddingInline
paddingBlock
The previous color
and contrast
properties have been deprecated and are due to be removed in 1.0.0.
Please migrate to the styles
property.
By setting a styles
property which conflicts with a prior color
or contrast
value, the styles
property will
take precedence.
The following will apply the badges to all components within your Story:
You can also selectively add badges to each Story:
When applying Badges to all Stories you can selectively remove them too:
In your mdx
documentation you can add badges to your stories
using the <Meta>
component.