Separator
A 1px horizontal or vertical divider line in the border token. Wraps Base UI Separator.
Code
import { Separator } from "@fadymondy/nasaq/web";export function Sections() { return ( <div className="flex flex-col gap-4"> <p>Profile</p> <Separator /> <p>Security</p> </div> );}Layout · stable
Live examples and controls: Separator in the lab.
Install
npx shadcn@latest add https://docs.nasaqui.com/r/separator.jsonA thin line that divides content. Horizontal by default (full width, 1px tall); vertical is 1px wide and
1rem (h-4) tall, centred on the cross axis so it sits between inline items such as header buttons.
There is no separator story of its own; it is demonstrated in apps/lab/stories/app-shell.stories.tsx
(vertical, between the sidebar trigger and the breadcrumbs).
When to use
- Dividing groups of related content or toolbar items.
- Visual rhythm between sections when spacing alone is not enough.
When not to use
- Separating levels of surface: use the surface tokens (COLOR); borders separate siblings, not levels.
- A divider inside a menu: use
DropdownMenuSeparator(DropdownMenu). - A breadcrumb chevron: use
BreadcrumbSeparator(Breadcrumb).
Import
import { Separator } from "@fadymondy/nasaq/web";
// inside this monorepo: "@nasaq/web"Quick start
import { Separator } from "@fadymondy/nasaq/web";
export function Sections() {
return (
<div className="flex flex-col gap-4">
<p>Profile</p>
<Separator />
<p>Security</p>
</div>
);
}Anatomy
Separator data-slot="separator" role="separator", aria-orientation from Base UIAPI
Separator
Base UI Separator props (ComponentProps<typeof BaseSeparator>).
| Prop | Type | Default | Description |
|---|---|---|---|
orientation? | "horizontal" | "vertical" | "horizontal" | Direction of the line. |
className? | string | none | Merged with shrink-0 bg-border and the size classes. |
render? | ReactElement | function | none | Base UI render prop. |
Horizontal: h-px w-full. Vertical: h-4 w-px self-center. Override the length with className (e.g. h-6), or pass className="h-auto self-stretch" to fill the cross axis of a flex row. The default stays h-4 so existing headers keep their look.
Examples
Vertical between toolbar items
import { Button, Separator } from "@fadymondy/nasaq/web";
export function Toolbar() {
return (
<div className="flex items-center gap-2">
<Button size="sm" variant="ghost">Bold</Button>
<Button size="sm" variant="ghost">Italic</Button>
<Separator orientation="vertical" />
<Button size="sm" variant="ghost">Link</Button>
</div>
);
}With labels in Arabic
import { Separator } from "@fadymondy/nasaq/web";
export function SectionsAr() {
return (
<div dir="rtl" className="flex flex-col gap-4">
<p>الملف الشخصي</p>
<Separator />
<p>الأمان</p>
</div>
);
}Accessibility
- Renders
role="separator"witharia-orientation. Screen readers announce it as a divider. - It is not focusable and has no keyboard behaviour.
- Base UI's Separator does not expose a
decorativeprop; if a line is purely decorative, consider a border utility on the container instead so it is not announced.
RTL & i18n
- A line is symmetric, so it does not mirror. Vertical separators sit between items in DOM order and follow
dir. - Use
me-*/ms-*for spacing (as the app-shell story does withclassName="me-1"), nevermr-*/ml-*. - No built-in strings.
Styling & tokens
- Colour:
bg-border. Change it with a token class such asbg-nq-line; never raw hex. - Target
[data-slot=separator],[data-orientation=vertical].
Do / Don't
- Do use borders to separate siblings on the same surface level.
- Do prefer spacing over a line when the grouping is already clear.
- Don't use separators as decoration or to fill empty space.
- Don't stack a separator directly against a card border.
Related
- AppShell · DropdownMenu · Card
Lab
https://docs.nasaqui.com/?path=/docs/components-layout-separator--docs