oakoss/ui
Components

Separator

A line that divides content, horizontally or vertically.

SourceReact Aria

Release notes

What changed in this version.

DocsSourceChangelog

Installation

npx shadcn@latest add @oakoss/separator

Usage

import { Separator } from '#/components/ui/layout/separator';

<Separator />;

Examples

Vertical

orientation="vertical" divides items in a row and stretches to the row's height.

BlogDocsSource

Accessibility

React Aria renders a horizontal separator as an <hr> and a vertical one as a <div>, both with role="separator"; a vertical one adds aria-orientation="vertical". Screen readers can announce it, but it isn't focusable and has no name: it's structure, not a control. Its content is presentational, so a label inside it isn't read; put text beside it instead. React Aria adds no keys.

The line is a border, so it stays visible in Windows High Contrast.

API

Separator

Renders React Aria's Separator. className applies to the line, which is a border: recolor it with a border-* class (border-primary) and thicken it with border-t-2, or border-s-2 when vertical, not with bg-* or h-*.

Props

Accepts React Aria Separator props. orientation defaults to the one a surrounding SeparatorContext provides, then horizontal, and elementType swaps the <hr> for another element.

Data attributes

AttributePresent when
data-slotAlways: separator
data-orientationAlways: horizontal or vertical