Skip to main content
PolyUI/docs

Base

Separator

Visual divider supporting horizontal and vertical orientations. The decorative prop controls ARIA semantics.

Installation

bash
npx polyui add separator

Orientation

Above

Below

LeftRight
tsx
import { Separator } from "@polyui/react/separator"
export function SeparatorOrientation() {
  return (
    <div className="space-y-4">
      <div>
        <p className="text-sm">Above</p>
        <Separator className="my-4" />
        <p className="text-sm">Below</p>
      </div>

      <div className="flex h-8 items-center gap-4">
        <span className="text-sm">Left</span>
        <Separator orientation="vertical" />
        <span className="text-sm">Right</span>
      </div>
    </div>
  )
}

Real World

ProfileSettingsLogout
tsx
import { Separator } from "@polyui/react/separator"
export function SeparatorRealWorld() {
  return (
    <div className="flex h-5 items-center space-x-4 text-sm">
      <span>Profile</span>
      <Separator orientation="vertical" />
      <span>Settings</span>
      <Separator orientation="vertical" />
      <span>Logout</span>
    </div>
  )
}

Props

属性类型默认值说明
orientation"horizontal" | "vertical""horizontal"The orientation of the separator. Vertical orientation requires a flex parent container.
decorativebooleantrueWhen true, hidden from screen readers.
classNamestringAdditional Tailwind class names for adjusting spacing or color.