Skip to content
All components
Primitives

Separator

Draw a thin horizontal or vertical line between neighboring groups of content or actions.

A rule in either orientation, hidden from assistive tech by default.

Installation

tdpxl is not an npm dependency of your app. The @tdpxl/cli command (not published to npm yet) copies the source into your project, with the registry items and npm packages it imports.

npx @tdpxl/cli add separator

Then import it from @/components/ui/separator. New project? Start with the installation guide.

Examples

Each example is one branch of the official demo, rendered in its own frame. The code is that branch as you would write it, with imports pointing at the default install paths.

Horizontal

Separate vertically stacked content with a horizontal rule. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import { Separator } from "@/components/ui/separator"

export function SeparatorHorizontal() {
  return (
    <div className="flex w-full max-w-sm flex-col gap-4">
      <Separator />
    </div>
  )
}

Vertical

Separate neighboring content with a vertical rule. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import { Separator } from "@/components/ui/separator"

export function SeparatorVertical() {
  return (
    <div className="flex w-full max-w-sm flex-col gap-4">
      <div className="flex h-6 items-center gap-3 text-paragraph-sm text-sub-600">
        <span>Docs</span>
        <Separator orientation="vertical" />
        <span>Components</span>
        <Separator orientation="vertical" />
        <span>Tokens</span>
      </div>
    </div>
  )
}

Semantic

Expose a separator to assistive technology with decorative set to false. Use it only when the division is meaningful beyond the visual line.

"use client"

import { Separator } from "@/components/ui/separator"

export function SeparatorSemantic() {
  return (
    <div className="flex w-full max-w-sm flex-col gap-4">
      <div className="flex flex-col gap-3 rounded-12 border border-soft-200 p-3 text-paragraph-sm">
        <div className="flex flex-col gap-1">
          <p className="text-label-sm text-strong-950">Account</p>
          <p className="text-sub-600">Profile, email and password.</p>
        </div>
        <Separator decorative={false} />
        <div className="flex flex-col gap-1">
          <p className="text-label-sm text-strong-950">Danger zone</p>
          <p className="text-sub-600">Delete the workspace and all of its data.</p>
        </div>
      </div>
    </div>
  )
}

Between actions

Divide groups of toolbar actions with a vertical rule. The separator is decorative and never receives focus.

"use client"

import { BoldIcon, ItalicIcon, LinkIcon, ListIcon } from "lucide-react"

import { Button } from "@/components/ui/button"
import { Separator } from "@/components/ui/separator"

export function SeparatorBetweenActions() {
  return (
    <div className="flex w-full max-w-sm flex-col gap-4">
      <div className="flex h-9 items-center gap-1">
        <Button iconOnly size="sm" emphasis="ghost" intent="neutral" aria-label="Bold">
          <BoldIcon />
        </Button>
        <Button iconOnly size="sm" emphasis="ghost" intent="neutral" aria-label="Italic">
          <ItalicIcon />
        </Button>
        <Separator orientation="vertical" className="mx-1" />
        <Button iconOnly size="sm" emphasis="ghost" intent="neutral" aria-label="Bulleted list">
          <ListIcon />
        </Button>
        <Button iconOnly size="sm" emphasis="ghost" intent="neutral" aria-label="Insert link">
          <LinkIcon />
        </Button>
      </div>
    </div>
  )
}

With label

Center short text between two lines. The label stays readable by assistive technology while the lines remain decorative.

"use client"

import { Separator } from "@/components/ui/separator"

export function SeparatorWithLabel() {
  return (
    <div className="flex w-full max-w-sm flex-col gap-4">
      <Separator label="or" />
    </div>
  )
}

Semantic with label

Label a semantic separator between groups. With decorative={false}, one line is exposed as a separator and the label text is read in order.

"use client"

import { Separator } from "@/components/ui/separator"

export function SeparatorSemanticWithLabel() {
  return (
    <div className="flex w-full max-w-sm flex-col gap-4">
      <div className="flex flex-col gap-3 text-paragraph-sm">
        <p className="text-sub-600">Deployed the billing service.</p>
        <Separator label="Yesterday" decorative={false} />
        <p className="text-sub-600">Rotated the API keys.</p>
      </div>
    </div>
  )
}

API reference

Generated from the component's TypeScript signatures. Inherited DOM and primitive props are listed separately.

Separator

Separate adjacent groups of content or controls.

Separator props
PropTypeDefaultDescription
orientation("horizontal" | "vertical") | undefined"horizontal"Either vertical or horizontal. Defaults to horizontal.
decorativeboolean | undefinedtrueWhether or not the component is purely decorative. When true, accessibility-related attributes are updated so that the rendered element is removed from the accessibility tree.
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
labelReact.ReactNode—Short text centered between two lines, such as "or" or a date. Horizontal only; the text stays readable by assistive technology while the lines remain decorative unless decorative is false.
Inherited props (14)
Separator inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

Accessibility & usage

From registry/ui/separator.meta.json (authored guidance; human review may still be pending). Behavior is checked by Storybook tests, not certified here.

When to use

  • Between sections of a settings panel, card or popover where spacing alone does not separate the groups clearly.
  • Between clusters of toolbar actions, as a vertical rule.
  • Between inline items in a row of metadata or links, as a short vertical rule.

When not to use

  • To create structure that headings, lists or landmarks should provide; a line is not a section title.
  • Between every item of a list; borders on the items or whitespace read cleaner.
  • As a draggable divider between panes; that is a resize handle with keyboard support.

Anatomy

Separator
Radix Separator root. orientation is horizontal (1px tall, full width) or vertical (1px wide, full height). decorative defaults to true. With label (horizontal only), it renders two lines with short centered text between them.

Keyboard & interaction

  • Not focusable and not operable; there is no keyboard or pointer behavior.
  • decorative (default true) removes it from the accessibility tree; decorative={false} exposes role="separator" with aria-orientation for vertical lines.
  • Expose it only when the division carries meaning beyond the visual line, for example between groups in a custom menu.

Responsive behavior

  • Horizontal separators stretch to the container width, so they adapt to any viewport.
  • Vertical separators take the full height of their flex container; give the row a height (or items-stretch) so the line is visible.
  • When a row with vertical separators wraps at narrow widths, the separators end up at line edges; switch the row to a column with horizontal separators or drop the separators below a breakpoint.

Content guidelines

  • No text: a separator never carries a label. Use Marker when the divider needs words.
  • Let the groups on either side have their own headings or labels; the separator only reinforces the split.
  • Keep labels to one or two words, such as or, a date, or a section name.

Alternatives

  • Marker — A labeled divider, such as a date between conversation messages.
  • Resizable — A divider people can drag or move with the keyboard to resize panes.
  • Card — A contained surface when groups need stronger grouping than a line.

Resources