如何禁用Storybook 7中每个Story下的自动生成文档页面?

huangapple go评论52阅读模式
英文:

How can I disable the auto-generated Docs page under each Story in Storybook 7?

问题

我迁移到了Storybook 7,现在在每个Story下都出现了Docs页面。

我正在使用自定义的mdx,不使用addon-docs。

为了摆脱以前自动生成的文档,我以前可以使用以下配置选项:

docs: {
    autodocs: false,
}

但现在不起作用。

如何在Storybook 7中禁用autodocs?

英文:

I migrated to Storybook 7 and now under each Story appeared Docs page.

I'm using custom mdx and I don't use addon-docs.

To get rid of autogenerated docs previously I could use the following config option:

docs: {
    autodocs: false,
}

But now it doesn't help.

How to disable autodocs in Storybook 7?

答案1

得分: 1

如果您想禁用特定组件的自动文档生成,请在您的 Meta 块中尝试以下操作:

export default {
  title: 'Example/Button',
  component: Button,
  // 删除这一行
  argTypes: {
    backgroundColor: { control: 'color' },
  },
};
英文:

If you want to disable autodocs for a specific component, you can try this in your Meta block

export default {
  title: 'Example/Button',
  component: Button,
  **tags: ['autodocs']**,//Remove this line
  argTypes: {
    backgroundColor: { control: 'color' },
  },
};

答案2

得分: 0

Sure, here is the translated content:

如果你想完全禁用整个Storybook实例的自动生成文档功能,你可以将以下配置添加到你的 main.js 文件中:

module.exports = {
  // 其他配置...
  features: {
    // 禁用自动生成文档
    storyStoreV7: false,
  },
};
英文:

If you want to disable autodocs completely for your entire Storybook instance, you can add the following configuration to your main.js file:

module.exports = {
  // other configuration...
  features: {
    // disable autodocs
    storyStoreV7: false,
  },
};

huangapple
  • 本文由 发表于 2023年6月6日 01:04:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/76408595.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定