分离器 Separator
Separator 组件用于在布局中添加分隔线,支持水平和垂直方向的分隔线,适用于视觉上的区分不同区域或内容的需求。
📦 引入方式
import { Separator } from '@itera-web/react-ui-separator';
🧩 使用示例
📚 创建水平分隔线
- 示例
- 源码
<Separator orientation="horizontal" />
📚 创建垂直分隔线
- 示例
- 源码
<Separator orientation="vertical" />
📚 自定义分隔线样式
- 示例
- 源码
<Separator className="bg-red-500 h-[2px]" orientation="horizontal" />
📚 在容器中使用垂直和水平分隔线
- 示例
- 源码
Section 1
Section 2
Footer
<div className="flex space-x-4">
<div>Section 1</div>
<Separator orientation="vertical" />
<div>Section 2</div>
</div>
<Separator orientation="horizontal" />
<div>Footer</div>
🧩 组件结构
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
orientation | 'horizontal' | 'vertical' | 'horizontal' | 设置分隔线的方向,默认为水平 |
decorative | boolean | true | 是否是装饰性分隔线,控制是否添加样式和行为 |
className | string | — | 自定义类名,用于扩展组件的样式 |
children | React.ReactNode | — | 子元素,通常为空,表示分隔线 |