React Bootstrap logoReact Bootstrap

DocTemplate

文档

组件文档模板,用于渲染单个组件的文档页,统一组合标题、示例与 API 文档

Component Demo

Basic usage and examples of the DocTemplate component

用法

DocTemplate 用于渲染完整的组件文档页,组合示例、属性表与类型定义。

属性数据

props 与 typeDefinitions 分别为 ApiProp[] 与 ApiTypeDefinition[],驱动属性表与类型定义区块。

内嵌切换

Demo

演示 embedded 属性切换

Component Demo

Basic usage and examples of the Demo component

这是内容区域。

API Documentation

Complete API reference for the Demo component

Props

属性名类型默认值描述
namestring-示例属性

API Documentation

Complete API reference for the DocTemplate component

Props

属性名类型默认值描述
componentDescriptionstring-组件描述
componentNamestring-组件名称(必填)
componentTagsstring[][]组件标签
demoContentReactNode-示例内容(由 DemoSection 组成)
embeddedbooleanundefined是否以嵌入模式渲染(仅内容,不渲染独立侧边栏),默认根据上下文自动判断
propsApiProp[]-属性列表(必填)
showCopyButtonbooleantrue是否显示代码复制按钮
typeDefinitionsApiTypeDefinition[][]类型定义列表

Type Definitions

DocTemplateProps

组件文档模板属性接口

export interface DocTemplateProps {
  componentDescription?: string;
  componentName: string;
  componentTags?: string[];
  demoContent?: ReactNode;
  embedded?: boolean;
  props: ApiProp[];
  showCopyButton?: boolean;
  typeDefinitions?: ApiTypeDefinition[];
}