此组件已弃用。当周围组件提供分隔符时,请优先使用 Separator 子组件,例如 Menu.Separator。否则,请编写您自己的 CSS,最好使用 @wordpress/theme 中可用的 设计令牌。
Divider 是一个布局组件,用于分隔一组相关的內容。
用法
import {
__experimentalDivider as Divider,
} from `@wordpress/components`;
import { Stack } from '@wordpress/ui';
function Example() {
return (
<Stack direction="column" gap="lg">
<span>Some text here</span>
<Divider />
<span>Some more text here</span>
</Stack>
);
}
属性
margin: number
调整内联轴上的所有边距。
- 必需:否
marginEnd: number
调整内联结束方向的边距。
- 必需:否
marginStart: number
调整内联开始方向的边距。
- 必需:否
orientation: horizontal | vertical
分隔线的方向。在 flex 容器内部使用时,您可能需要确保分隔线为 stretch 对齐,以便其可见。
- 必需:否
- 默认值:
horizontal
继承的属性
Divider 还继承了所有 Separator 属性。