Back to Ant Design

Divider

components/divider/index.zh-CN.md

6.3.72.6 KB
Original Source

何时使用 {#when-to-use}

  • 对不同章节的文本段落进行分割。
  • 对行内文字/链接进行分割,例如表格的操作列。

代码演示 {#examples}

<!-- prettier-ignore -->

<code src="./demo/horizontal.tsx">水平分割线</code> <code src="./demo/with-text.tsx">带文字的分割线</code> <code src="./demo/size.tsx" version="5.25.0">设置分割线的间距大小</code> <code src="./demo/plain.tsx">分割文字使用正文样式</code> <code src="./demo/vertical.tsx">垂直分割线</code> <code src="./demo/customize-style.tsx" debug>样式自定义</code> <code src="./demo/component-token.tsx" debug>组件 Token</code> <code src="./demo/variant.tsx">变体</code> <code src="./demo/style-class.tsx" version="6.0.0">自定义语义结构的样式和类</code>

API

通用属性参考:通用属性

参数说明类型默认值版本
children嵌套的标题ReactNode-
className分割线样式类string-
classNames用于自定义组件内部各语义化结构的 class,支持对象或函数Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-
dashed是否虚线booleanfalse
orientation水平或垂直类型horizontal | verticalhorizontal-
orientationMargin标题和最近 left/right 边框之间的距离,去除了分割线,同时 titlePlacement 不能为 center。如果传入 string 类型的数字且不带单位,默认单位是 pxstring | number-
plain文字是否显示为普通正文样式booleanfalse4.2.0
style分割线样式对象CSSProperties-
styles用于自定义组件内部各语义化结构的行内 style,支持对象或函数Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-
size间距大小,仅对水平布局有效small | medium | large-5.25.0
titlePlacement分割线标题的位置start | end | centercenter-
type水平还是垂直类型horizontal | verticalhorizontal-
variant分割线是虚线、点线还是实线dashed | dotted | solidsolid5.20.0
vertical是否垂直,和 orientation 同时配置以 orientation 优先booleanfalse-

Semantic DOM

<code src="./demo/_semantic.tsx" simplify="true"></code>

主题变量(Design Token){#design-token}

<ComponentTokenTable component="Divider"></ComponentTokenTable>