DocsLayout
文档布局文档站点布局组件,组合顶部导航、左侧组件目录、主内容区、右侧页面目录与页脚,不依赖特定路由库,并支持内嵌模式
Component Demo
Basic usage and examples of the DocsLayout component
用法
DocsLayout 提供顶部导航栏、左侧组件目录、主内容区、右侧页面目录(当前文档页的组件选项)与页脚的统一布局,通过 children 与 pathname 传入当前页面内容与地址。
自定义目录标题
通过 sidebarTitle 与 rightSidebarTitle 自定义左右目录标题。
内嵌布局
这是内嵌在容器中的布局内容,不显示顶部导航与右侧目录,侧边栏不再固定为全屏高度。
受控路由切换
当前路由:/button
API Documentation
Complete API reference for the DocsLayout component
Props
| 属性名 | 类型 | 默认值 | 描述 |
|---|---|---|---|
children | ReactNode | - | 主内容区域(当前文档页内容) |
docs | DocConfig[] | - | 文档配置列表(必填) |
embedded | boolean | false | 是否以内嵌模式渲染(不显示顶部导航与右侧目录,侧边栏不固定) |
githubUrl | string | 'https://github.com/dafengzhen/react-bootstrap' | 页脚 GitHub 链接 |
navItems | DocsNavItem[] | [] | 顶部导航项列表,非空时显示顶部导航栏 |
navTitle | string | - | 顶部导航栏品牌标题,传入后在导航栏左侧渲染品牌链接 |
pathname | string | - | 当前路由地址,用于高亮目录项与导航项 |
renderLink | RenderLink | - | 自定义链接渲染函数,用于接入路由库 |
rightSidebarTitle | string | 'On This Page' | 右侧页面目录标题(当前文档页的组件选项) |
sidebarTitle | string | 'Components' | 左侧组件目录标题 |