You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在React版Storybook的CSF格式故事中添加说明文案?

你可以直接用Storybook CSF规范内置的 parameters.docs.description.story 字段给单个故事添加说明文案,该字段支持原生Markdown语法,渲染后会显示在对应故事的文档区域,完全不会混入代码示例中。

针对你的场景,写法如下:

export const FewAssets = (args) => (
  <Selector assets={[fixtures[0], fixtures[1]]} />
);
FewAssets.args = {};
FewAssets.parameters = {
  docs: {
    description: {
      story: `### Few Assets
With only a few assets, the slider works the same way but without moving the thumbnails.
`
    }
  }
};

如果你需要给整个组件级添加统一的说明文案,写在默认导出的 parameters.docs.description.component 字段即可:

export default {
  title: 'Components/Selector',
  component: Selector,
  parameters: {
    docs: {
      description: {
        component: '此处为组件整体说明,会展示在所有故事的文档顶部'
      }
    }
  }
}

你所用的6.3.x版本已经完整支持该配置,无需额外安装依赖或调整其他配置。

内容的提问来源于stack exchange,提问作者Sir Robert

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.24 12:54:09