question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CSF3: Default render functions for non-React frameworks

See original GitHub issue

CSF3.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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
shilmancommented, Jan 24, 2022

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!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there’s still more to do.

1reaction
gossicommented, Jul 9, 2021

Default render function for ember is not possible. But I already asked for a render() function in the default 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:

  • Create a ticket for that doc task
  • Link it to ember
  • Check off ember from the list =)
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found