Skip to content

Components / Separator

Separator

Visually divide groups of content with a horizontal or vertical line. Keep it decorative by default, or opt into a semantic separator when the boundary adds meaning.

Storybook runs locally or as a separately hosted build; no hosted Storybook is configured. Source and setup links match the install revision.

Usage playground

Separate two groups of notes. Change the line’s orientation and whether it adds a semantic boundary. Vertical mode gives the parent an explicit 6rem height; orientation alone does not create layout.

Design notes

Implementation notes

React / TSX
'use client';

import { Separator } from "@/components/ui/yads-separator";

export default function NotesExample() {
  return <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'stretch', gap: '1rem', width: '100%', maxWidth: '24rem', minWidth: 0 }}>

Installation

pnpm dlx [email protected] add biehlio/yet-another-design-system/separator#e7b31d0e0c9d8b24d53e97ca38b3b68d345e9f40

This revision-pinned command installs yads-separator, its scoped stylesheet and Radix Separator. Import { Separator } from @/components/ui/yads-separator (adjust your alias). No Tailwind, reset, font install, global CSS or theme provider is required. Light is the default; the nearest explicit light/dark boundary wins. See API reference for native @scope browser support.

Copy sample copies a complete React module, including layout and recipe CSS, even when collapsed. Samples need only this registry item and include a client boundary for React Server Component apps. Playground controls are documentation controls, not extra Separator props.

Horizontal and vertical composition

A horizontal line spans the available width. Vertical lines use 100% of their parent’s height: this row explicitly sets 1.25rem (20px). A flex row with only automatic height may leave the line with no visible height. Use an explicit parent height or set the Separator’s own height. The text labels below are not links.

Component library

Reusable building blocks for the web.

Blog
Docs
Source
React / TSX
'use client';

import { Separator } from "@/components/ui/yads-separator";

export default function LibrarySummary() {
  return <div style={{ display: 'grid', gap: '1rem', width: '100%', maxWidth: '24rem', minWidth: 0 }}>

className customization

Override dimensions with style or a sufficiently specific class. This 3px, three-quarter-width semantic boundary retains the scoped light/dark color. Margin and surrounding layout belong to the consumer; there are no size or variant props.

Account details

Notification preferences

React / TSX
'use client';

import { Separator } from "@/components/ui/yads-separator";

export default function SectionBoundary() {
  return <div style={{ display: 'grid', gap: '1rem', width: '100%', maxWidth: '24rem', minWidth: 0 }}>

Accessibility

  • Decorative by default. YADS sets decorative=true, like the shadcn wrapper; the underlying Radix primitive alone defaults to semantic. Decorative lines render role="none" rather than aria-hidden. They do not appear as semantic separators. Keep the line empty: role="none" does not hide arbitrary descendants.
  • Opt into meaningful separation. Set decorative=false when the boundary between content groups should be exposed to assistive technology. The result has role="separator". Vertical semantic lines have aria-orientation="vertical"; horizontal is the implicit default and has no explicit aria-orientation attribute.
  • No keyboard stop. Separator has no default tabIndex, keyboard behavior or focus ring. Do not turn it into a button or add a Tab stop. Native events and attributes pass through, but it is not an interactive splitter, drag handle or resizer and has no value/min/max API.
  • Structure still matters. Use headings, sections and spacing to organize content. A line is not a label, fieldset legend, status or loading indicator. FieldSeparator remains a separate Field composition; installing Separator neither installs nor changes it.

API reference

Import { Separator, type SeparatorProps } from @/components/ui/yads-separator. Props derive from Radix Separator Root, including native div attributes/events and asChild. The default root is a div; its ref is forwarded unchanged. Native props are not filtered: consumer overrides can alter semantics or focusability, so preserve the noninteractive contract.

On narrow screens, focus the table and scroll horizontally to read all columns.

Separator props, types, defaults and behavior
PropTypeDefaultDescription
orientation'horizontal' | 'vertical''horizontal'Selects data-orientation and line dimensions. Vertical lines need a definite parent height or an explicit line height. Does not arrange siblings.
decorativebooleantruetrue: role="none", no implicit separator semantics. false: role="separator"; vertical also sets aria-orientation="vertical". Horizontal omits aria-orientation because horizontal is the implicit ARIA default.
className / stylestring / CSSPropertiesNot setScoped class is retained. Set dimensions, spacing and consumer recipes; default thickness is 1px.
refReact.Ref<HTMLDivElement>Not setForwarded to the actual Radix root div for measurement. No focus management.
asChildbooleanfalseInherited Radix composition: merges props into one child instead of a div. Supply a compatible noninteractive element that forwards props/ref and preserve semantics.
Native attributes / eventsSeparatorPropsNot setid, title, data-*, aria-* and native div events pass through. Avoid role/aria-orientation overrides that contradict decorative or orientation. Do not add tabIndex or interactive children.

Themes, fonts and browser support

Light is the standalone default. The nearest explicit theme wins: .dark or data-theme="dark" enables dark colors; .light or data-theme="light" stops an outer dark scope. data-theme takes precedence when present. Changing these boundaries updates live, without a provider. Scoped CSS uses native @scope: use browsers with @scope support (Chrome/Edge 118+, Safari 17.4+, Firefox 146+). Without it, the light base remains; dark theming requires @scope.

No font dependency is installed or imported: a decorative line renders no typography. Surrounding content uses your application’s font. Only Radix Separator and the two registry files are required; no cn helper, Tailwind, reset, global tokens, site CSS or provider.

Playground defaults and limitations

Reset restores horizontal, decorative separation. Orientation and Meaning update both the preview and complete copied module. Vertical mode copies an explicit 6rem parent height. The component does not calculate layout or parent height, collapse spacing, resize panels or manage application state. There is no size, variant, animation or Field integration API.