2017-08-19 12:39:11 +08:00
|
|
|
|
---
|
|
|
|
|
category: Components
|
|
|
|
|
title: Divider
|
|
|
|
|
subtitle: 分割线
|
2024-03-22 14:22:42 +08:00
|
|
|
|
description: 区隔内容的分割线。
|
2022-11-30 20:14:41 +08:00
|
|
|
|
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*7sMiTbzvaDoAAAAAAAAAAAAADrJ8AQ/original
|
2023-02-09 22:17:31 +08:00
|
|
|
|
coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*KPSEQ74PLg4AAAAAAAAAAAAADrJ8AQ/original
|
2022-11-09 12:28:04 +08:00
|
|
|
|
demo:
|
|
|
|
|
cols: 2
|
|
|
|
|
group:
|
|
|
|
|
title: 布局
|
|
|
|
|
order: 2
|
2017-08-19 12:39:11 +08:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## 何时使用
|
|
|
|
|
|
|
|
|
|
- 对不同章节的文本段落进行分割。
|
|
|
|
|
- 对行内文字/链接进行分割,例如表格的操作列。
|
|
|
|
|
|
2022-11-09 12:28:04 +08:00
|
|
|
|
## 代码演示
|
|
|
|
|
|
2022-11-17 17:31:26 +08:00
|
|
|
|
<!-- prettier-ignore -->
|
2022-11-09 12:28:04 +08:00
|
|
|
|
<code src="./demo/horizontal.tsx">水平分割线</code>
|
|
|
|
|
<code src="./demo/with-text.tsx">带文字的分割线</code>
|
|
|
|
|
<code src="./demo/plain.tsx">分割文字使用正文样式</code>
|
|
|
|
|
<code src="./demo/vertical.tsx">垂直分割线</code>
|
|
|
|
|
<code src="./demo/customize-style.tsx" debug>样式自定义</code>
|
2023-08-11 13:43:44 +08:00
|
|
|
|
<code src="./demo/component-token.tsx" debug>组件 Token</code>
|
2022-11-09 12:28:04 +08:00
|
|
|
|
|
2017-08-19 12:39:11 +08:00
|
|
|
|
## API
|
|
|
|
|
|
2023-08-08 18:27:48 +08:00
|
|
|
|
通用属性参考:[通用属性](/docs/react/common-props)
|
|
|
|
|
|
2021-03-01 19:20:48 +08:00
|
|
|
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
|
|
|
|
| --- | --- | --- | --- | --- |
|
2021-09-19 11:28:45 +08:00
|
|
|
|
| children | 嵌套的标题 | ReactNode | - | |
|
2021-03-01 19:20:48 +08:00
|
|
|
|
| className | 分割线样式类 | string | - | |
|
|
|
|
|
| dashed | 是否虚线 | boolean | false | |
|
|
|
|
|
| orientation | 分割线标题的位置 | `left` \| `right` \| `center` | `center` | |
|
2023-06-03 12:45:26 +08:00
|
|
|
|
| orientationMargin | 标题和最近 left/right 边框之间的距离,去除了分割线,同时 `orientation` 必须为 `left` 或 `right`。如果传入 `string` 类型的数字且不带单位,默认单位是 px | string \| number | - | |
|
2021-03-01 19:20:48 +08:00
|
|
|
|
| plain | 文字是否显示为普通正文样式 | boolean | false | 4.2.0 |
|
|
|
|
|
| style | 分割线样式对象 | CSSProperties | - | |
|
|
|
|
|
| type | 水平还是垂直类型 | `horizontal` \| `vertical` | `horizontal` | |
|
2023-03-27 15:33:22 +08:00
|
|
|
|
|
2023-08-30 23:02:35 +08:00
|
|
|
|
## 主题变量(Design Token)
|
2023-03-27 15:33:22 +08:00
|
|
|
|
|
|
|
|
|
<ComponentTokenTable component="Divider"></ComponentTokenTable>
|