Skip to Content
Neshel-UI
Components

Separator

A horizontal or vertical rule, semantic or decorative.

Server-compatible (no "use client")

Purpose

Separator visually divides content. Semantic separators are announced as a thematic break; decorative ones are hidden from assistive technology.

Import

import.tsx
import { Separator } from "@neshel-ui/components";

Usage

Preview: separator-basic
Preview theme

Profile settings

Docs
Blog
separator-basic.tsx
import { Separator } from "@neshel-ui/components";
import { Inline, Stack } from "@neshel-ui/layout";
import { Paragraph, Text } from "@neshel-ui/typography";

export default function SeparatorBasic() {
  return (
    <Stack space="4">
      <Paragraph>Profile settings</Paragraph>
      {/* Semantic: a thematic break that assistive technology announces. */}
      <Separator />
      <Inline space="3" alignY="stretch" className="h-6">
        <Text>Docs</Text>
        {/* Decorative: purely visual, hidden from assistive technology. */}
        <Separator orientation="vertical" decorative />
        <Text>Blog</Text>
      </Inline>
    </Stack>
  );
}

API

SeparatorProps

SeparatorProps
PropTypeDefaultDescription
decorativeboolean—Purely visual: role="none" instead of role="separator".
orientation"horizontal" | "vertical""horizontal"Direction of the rule (default "horizontal").
refRef<HTMLDivElement>——

Also accepts the props of: React DOM attributes.

  • Semantic (default): role="separator", plus aria-orientation="vertical" when vertical.
  • decorative: role="none".

Accessibility

Use the semantic form only when the division has meaning (between groups of content). Between items in a toolbar or breadcrumb, use decorative.

Common mistakes

  • A vertical separator in a container without height: give the row a height or alignY="stretch".
  • For separators between Stack/Inline items, the layout separator prop is often simpler.
Edit on GitHub

On this page