Storybook: Addon-docs: Canvas-only stories

Created on 22 Aug 2019  路  11Comments  路  Source: storybookjs/storybook

Users wish to define stories that show up in Storybook's canvas (and in visual regression tests, etc) but not to show up in docs.

Case 1: DocsPage

User defines stories in CSF and renders docs using DocsPage, but wishes to exclude some fo the stories from the DocsPage to reduce noise on the page.

Case 2: MDX Stories

User writes documentation & stories side-by-side in a single MDX file, and wants those stories to show up in the canvas but not in the docs themselves. They want something similar to the recipe "CSF stories with MDX docs" but want to do everything in MDX

Proposed solution

Stories get an optional docs.disable parameter that:

  • [ ] Excludes it from DocsPage if applied in CSF
  • [ ] Doesn't render the story in the Docs tab if applied in MDX

CSF

export const foo = () => <Button label="foo" />
foo.story = { parameters: { docs: { disable: true } } }

MDX

<Story name="foo" parameters={{ docs: { disable: true }} >
  <Button label="foo" />
</Story>
docs feature request high priority todo

Most helpful comment

That's exactly what I am looking for! Please make it happen. 馃憤

All 11 comments

That's exactly what I am looking for! Please make it happen. 馃憤

@mdvorscak @Contrapuntist that is exactly what we are looking for as well.

Awesome

Good golly!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.0-alpha.13 containing PR #8313 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

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

Hello, I'm highly interested in this parameter however when I tried it on some stories in my project nothing happened. Is this working with Angular?

@arnaud-ly You're using 5.3.0-beta.x? Should work with Angular. If not, please LMK what you're seeing

@shilman Yeah I'm currently on 5.3.0-beta.21. When I disable the paremeter docs, it's like i didn't do anything. Nothing seems to change.

@arnaud-ly do you have a repo I could look at?

Yeah sure, here [email protected]:arnaud-ly/docsDisableStoryBookExample.git

@arnaud-ly This repro is using addon-docs 5.2.8

@shilman Thank you!

Was this page helpful?
0 / 5 - 0 ratings