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.

Addon-docs: Support non-story exports in module story format

See original GitHub issue

Storybook docs is shipping with a new story format for ES6 modules based on this gist that treats all named exports as stories.

Opening this issue as a place to discuss how we might also support non-story exports. This came up in https://github.com/storybookjs/storybook/issues/6995 but it is a generally useful feature for exporting reusable story data.

Here’s a simple example for the discussion:

export default {
  title: 'components/Button'
}; // stories metadata
export normal = () => <Button>Hello button</Button> // a story
export someData = { foo: 1, bar: 2 } //????

Three proposals so far from @tmeasday / @ndelangen / @shilman include marking individual stories, specifying story exports, and filtering non-story exports.

Marking stories

export normal = () => <Button>Hello button</Button>;
normal.isStory = true;

Which could be stylized as:

import { story } from '@storybook/story';
export normal = story(() => <Button>Hello button</Button>);

Specifying story exports

export default {
  title: 'components/Button'
  storyExports: ['normal'] // defaults to all exports as stories
};
...

Filtering non-story exports

export default {
  title: 'components/Button'
  ignoreExports: ['someData'] // defaults to all exports as stories
};
...

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
tmeasdaycommented, Jun 17, 2019

I think if we can make the black/whitelist easily configurable via params, then we shouldn’t have a default – to me that falls under the purview of magic that the user might not know about and find hard to debug (why is my story _iLoveUnderscores not showing up?)

0reactions
bdombrocommented, Sep 10, 2021

Hint: To use the new feature you can now allowList using includeStories: ['myStory1', ...] or blockList using excludeStores: ['myNonStoryExport', ...] in export default

Read more comments on GitHub >

github_iconTop Results From Across the Web

storybook/addon-docs
DocsPage is a zero-config aggregation of your component stories, text descriptions, docgen comments, props tables, and code examples into clean, ...
Read more >
Component Story Format (CSF) - Storybook
Every component story file consists of a required default export and one or more named exports. CSF is supported in all frameworks except...
Read more >
storybook/core-server: Versions
Vite: Export storybook utilities from frameworks for better pnpm support #19216 ... Addon-docs: Fix canvas support expand code for non-story #18808 ...
Read more >
@storybook/addon-docs | Yarn - Package Manager
how to introduce significant new features (e.g. vue support, story hierarchy)?; how to converge on key design decisions (e.g. new addons API)?; how...
Read more >
storybookjs/storybook (Raised $170.00)
[Bug]: non-story content not working with angular components. Unfunded#19696created byadmir86 ... Module '"@storybook/vue3"' has no exported member 'app'.
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