storybook icon indicating copy to clipboard operation
storybook copied to clipboard

[Feature Request]: Storybook 7 - opt-out of autodocs for a single story when `autodocs: true`

Open tannera opened this issue 2 years ago • 14 comments

Is your feature request related to a problem? Please describe

When using autodocs: true in main.js a doc is generated for every story. But there may be edge-cases like for a Welcome page where we do not want a doc page generated.

Describe the solution you'd like

It would be nice to be able to opt-out of the autodocs on a story level with:

export default {
  title: 'Welcome to Storybook',
  component: () => <>Welcome</>,
  parameters: {
    docs: {
      autodocs: false, // overrides the default just for this story
    },
  },
} as Meta;

Describe alternatives you've considered

Using autodocs: 'tags' but this would be a lot of boilerplate since all our stories would require the autodocs tag, and only a single Welcome story would be opted out.

Are you able to assist to bring the feature to reality?

yes, I can

Additional context

No response

tannera avatar Feb 14 '23 12:02 tannera

We're in the same situation where this feature would be very useful

david-keefe avatar Apr 14 '23 15:04 david-keefe

I put up a PR adding the ability to set tags: ['no-autodocs'] to support this feature: https://github.com/storybookjs/storybook/pull/22116

willwill96 avatar Apr 17 '23 03:04 willwill96

I also think this is a very useful feature

luis-pato avatar May 25 '23 06:05 luis-pato

+1 i need this as well

daviesgeek avatar Jun 06 '23 22:06 daviesgeek

Bumping this as it would prove useful to us as well. I'd expect autodocs: false per-Story would disable this otherwise great feature for a single story! 😉

CHE1RON avatar Jun 13 '23 07:06 CHE1RON

+1 This will definitely help. While migrating from v6 to v7, I had to enable autodocs globally since it was not good practice to write tags: ['autodocs'] in huge number of files and skip a few just for those who have a documentation file in .mdx.

vamsikdev avatar Jun 15 '23 07:06 vamsikdev

+1 would be very useful

remi-martinez avatar Jun 21 '23 08:06 remi-martinez

+1 This would be really nice to have.

I also have multiple cascading stories using the interaction tests, and each stories reuse the test from the previous story. So at the end when you check the story individually it will display the final state, however on the auto generated doc, you will only see the first render before the interaction tests are applied. So you will have multiple stories but all of them on the same stage.

Screenshot 2023-06-21 at 8 14 51 PM

So being able to hide/disable a specific story would be very nice to have.

caribouflex avatar Jun 22 '23 00:06 caribouflex

+1 we really want this to be an option... We have a Snackbar component. We have different types of Snackbars, but the maximum the stack can display is 3 so we split them in different stories to showcase them all. However, each of these stories generate docs because autodocs is set to true... We want to just refer to our general Snackbar.stories.mdx docs file.

Danielvandervelden avatar Jul 06 '23 10:07 Danielvandervelden

+1 this would be great for us as well.

larrygotto avatar Jul 19 '23 18:07 larrygotto

+1 this would be super useful for us

ofirl avatar Jul 21 '23 09:07 ofirl

+1

lukemcd-hero avatar Jul 25 '23 14:07 lukemcd-hero

Probably you guys are aware, but I figured that if you export a story that matches the default name for your autogenerated docs, then Storybook will merge the two leaving just the "docs" view. It's the opposite of what you want @tannera, but could still prove handy.

import { Meta } from "@storybook/react"
import * as React from "react"

import { ColorPalette } from "./ColorPalette"

const meta: Meta = {
  title: "Foundation/Colors",
  component: ColorPalette,
}

export default meta

export const Documentation = () => <ColorPalette /> // <= This line does what I'm describing

The name for the autogenerated docs is "Documentation" in our project.

LorinWeb avatar Jul 26 '23 17:07 LorinWeb

Unfortunately, got an error for storybook/vue3

Error: You have a story for Design system/Colors with the same name as your component docs page (Docs), so the docs page is being dropped. Use <Meta of={} name="Other Name"> to distinguish them.

upikoth avatar Jan 22 '24 21:01 upikoth