跳到导航

Indent

以 Markdown 格式查看

<Indent> 组件添加左侧缩进以创建微妙的视觉辅助,帮助在引用块和具有多层嵌套参数的长 API 页面中保持可读性。

与只接受 <File> 和 <Folder> 子元素的 <Folder> 组件不同,<Indent> 可以与所有其他组件配合使用,包括手风琴、参数字段、代码块和文本。

使用方法

此文本未缩进。

此文本已缩进。

此文本再次未缩进。

Markdown
此文本未缩进。
<Indent>
此文本已缩进。
</Indent>
此文本再次未缩进。

变体

与其他组件结合

将 <Indent> 与手风琴和参数字段等其他组件结合使用,以组织复杂的层次结构。

属性:
id
stringRequired

用户的唯一标识符

email
stringRequired

用户的电子邮件地址

name
string

用户的显示名称

Markdown
<Accordion title="class User">
<div><strong>属性:</strong></div>
<Indent>
<ParamField path="id" type="string" required={true}>
用户的唯一标识符
</ParamField>
<ParamField path="email" type="string" required={true}>
用户的电子邮件地址
</ParamField>
<ParamField path="name" type="string">
用户的显示名称
</ParamField>
</Indent>
</Accordion>

多层嵌套

将 <Indent> 组件嵌套多个层级以显示复杂的 API 参数层次结构。每个层级都会添加另一层缩进。

config
objectRequired

应用程序配置对象

config.database
objectRequired

数据库连接设置

config.database.host
stringRequired

数据库服务器主机名

config.database.credentials
objectRequired

身份验证凭据

config.database.credentials.username
stringRequired

数据库用户名

config.database.credentials.password
stringRequired

数据库密码

config.cache
object

缓存配置

config.cache.ttl
number

生存时间(秒)

Markdown
<ParamField path="config" type="object" required={true}>
应用程序配置对象
</ParamField>
<Indent>
<ParamField path="config.database" type="object" required={true}>
数据库连接设置
</ParamField>
<Indent>
<ParamField path="config.database.host" type="string" required={true}>
数据库服务器主机名
</ParamField>
<ParamField path="config.database.credentials" type="object" required={true}>
身份验证凭据
</ParamField>
<Indent>
<ParamField path="config.database.credentials.username" type="string" required={true}>
数据库用户名
</ParamField>
<ParamField path="config.database.credentials.password" type="string" required={true}>
数据库密码
</ParamField>
</Indent>
</Indent>
<ParamField path="config.cache" type="object">
缓存配置
</ParamField>
<Indent>
<ParamField path="config.cache.ttl" type="number">
生存时间(秒)
</ParamField>
</Indent>
</Indent>

属性

children
ReactNodeRequired

要缩进的内容。可以包含任何 React 元素、组件、文本或 markdown。

className
string

用于自定义样式的可选 CSS 类名。该组件默认包含 fern-indent 类,可用于自定义样式。