Component Story Format 3.0 #15500
Replies: 6 comments 16 replies
-
It would be great to extend CSF 3.0 to support dynamically creating an array of (named) stories. In pseudo typescript, could be something like below:
and that would put those stories in a group named |
Beta Was this translation helpful? Give feedback.
-
At Userlike, we already had an abstraction of some sorts over CSF 2.0 to have type safety (and to reduce boilerplate/weirdness). So with our abstraction, a story module looks as follows:
Function calls are usually easier to use than type annotations and allows us to manipulate options. For example, we have our own I'm not giving a concrete suggestion here, but when we switch to CSF 3.0, we will keep our abstraction because I think it's more powerful. |
Beta Was this translation helpful? Give feedback.
-
Moving forward with CSF, what's the official stance on how to handle cases like component libraries in which each component has a few variants and perhaps each variant has a few sub-variants? And what about their visual reg. tests using chromatic? |
Beta Was this translation helpful? Give feedback.
-
We are reusing stories a lot in other stories with CSF2:
But how is this supposed to work with CSF3? In this case stories are no functions anymore. |
Beta Was this translation helpful? Give feedback.
-
Thank you for designing a simpler, more framework-independent format! As far as I understand, CSF2 stories that encompass multiple components cannot be translated for CSF3. Here is a problematic example: // buttons.stories.jsx (CSF2)
import { Button, LinkButton } from './buttons';
export default {
title: "Button",
component: Button,
}
export const Default = Button.bind({});
Default.args = {
label: "a button"
};
export const Link = LinkButton.bind({});
Link.args = {
label: "a link",
href: "https://www.example.com"
}; Arguably, the most natural solution would be what @anilanar mentioned before, i.e. allowing each example to override the // buttons.stories.jsx (CSF3)
import { Button, LinkButton } from './buttons'.;
export default {
title: "Button",
component: Button,
}
export const Default = {
args: {
label: "a button"
}
};
export const Link = {
component: LinkButton,
args: {
label: "a button",
href: "https://www.example.com"
}
}; How much work would it be to support this? I'm asking because I plan to use CSF3 with this additional |
Beta Was this translation helpful? Give feedback.
-
Saw this CSF3 as part of 7 beta announcement. Currently CSF2 stories are components and can use imported in Jest to run tests against it. How is that going to work in CSF3 where exports are objects? |
Beta Was this translation helpful? Give feedback.
-
We just released experimental Component Story Format 3.0, a backwards-compatible improvement on Storybook stories.
CSF 3.0 eliminates boilerplate and adds support for scripted interactions:
We'd love your feedback to help us improve CSF3.0 through the 6.4 release cycle. Please comment below, or join us in the Storybook Discord in the
#component-story-format
channel. We've also labeled known issues with csf3.If you're using Storybook 6.4 prerelease, turn on
previewCsf3
in your.storybook/main.js
config:CSF 3.0—except automatic title generation—is also available behind the same flag in SB 6.3.
Beta Was this translation helpful? Give feedback.
All reactions