CSF3: Default render functions for non-React frameworks
See original GitHub issueCSF3.0 introduces default render functions, making it possible to remove lots of boilerplate in your stories. The initial implementation is for React, and we still need to add this for other popular frameworks.
- Vue
- Vue3
- Angular
- Web-components
- Svelte
Here’s a React example:
// CSF 2.0
export const Primary = (args) => <Button {...args} />
Primary.args = { primary: true };
// CSF 3.0
export const Default = { args: { primary: true } }
And here’s the React implementation:
https://github.com/storybookjs/storybook/blob/next/app/react/src/client/preview/index.tsx#L22-L28
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:11 (10 by maintainers)
Top Results From Across the Web
Component Story Format 3.0 - Storybook - JS.ORG
So in CSF 3.0 we are providing default render functions for each framework. If all you're doing is spreading args into your component—which...
Read more >Component Story Format
In CSF 3.0, story rendering is defined through render functions . You would typically define a local default render function like this: export...
Read more >ReactDOM
render () controls the contents of the container node you pass in. Any existing DOM elements inside are replaced when first called. Later...
Read more >storybook/manager-webpack5: Versions
React : Fix issue with react 18 implementation #19125 ... Core: Allow a teardown function to be returned from renderToDOM (#18457); CLI: Add...
Read more >@storybook/docs-tools | Yarn - Package Manager
Shared utility functions for frameworks to implement docs ... 6.5.12 (September 14, 2022). Bug Fixes. React: Fix issue with react 18 implementation #19125 ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ermahgerd!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-alpha.23 containing PR #17279 that references this issue. Upgrade today to the
@next
NPM tag to try it out!Closing this issue. Please re-open if you think there’s still more to do.
Default render function for ember is not possible. But I already asked for a
render()
function in thedefault
export of a stories file, which @shilman mentioned is possible? That’s what ember would go for here, needs to be documented then.My suggestions: