Skip to main content

Divider

The Divider component is used to visually separate content in layouts.
It supports horizontal and vertical orientations, custom thickness, variants, and even allows embedding children (like text or labels) inside the divider.

import { Divider } from "tawuniya/components";

👉 View in Storybook

Props​

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"Defines the orientation of the divider.
variantVariant from dividerVariants-Controls style variant (e.g., solid, dashed, etc. based on your variants).
toneVariant from dividerVariants-Controls the color tone of the divider.
flexItembooleanfalseIf true, stretches the divider to fill available flex space.
thicknessnumber1Sets the divider thickness (in pixels).
childrenReact.ReactNode-Content displayed inside the divider (usually a label).
classNamestring-Additional Tailwind CSS classes.
...propsReact.HTMLAttributes<HTMLDivElement>-Standard HTML attributes passed to the rendered element.

Usage​

Horizontal Divider (default)​

<Divider />

Vertical Divider​

<div className="flex h-10 items-center space-x-2">
<span>Item 1</span>
<Divider orientation="vertical" />
<span>Item 2</span>
</div>

Custom Thickness​

<Divider thickness={4} />

With Label​

<Divider>OR</Divider>

Custom Tone​

<Divider tone="primary" />
<Divider tone="muted" />
<Divider tone="destructive" />

Notes​

  • When using children, the divider renders two lines with the content centered between them.
  • Vertical dividers should typically be used inside a flex container (flex-row).
  • Thickness is applied as height (for horizontal) or width (for vertical).