Skip to content
Nizivo UI

Separator

An <hr>: a 1 px border/subtle line, Figma's Divider (7370:95). Decorative by default; spacing comes first, a line only when spacing is not enough (the Figma doc).

Server component, no client JS

Import

import { Separator } from '@nizivo/react/separator';

// Once per app (Getting started), after
// @nizivo/tokens/tokens.css and @nizivo/react/css/base.css
import '@nizivo/react/css/separator.css';

Decorative by default

A Separator is decorative unless you say otherwise: it renders <hr role="none">, so a screen reader skips it, as Figma's Divider (7370:95) intends ("spacing first, a line only when spacing is not enough"). Most lines between actions, rows or card sections only draw. Pass decorative={false} for a break that means something on its own, such as the rule above an order total or between two groups of settings: the <hr> keeps its implicit separator role, with aria-orientation when it is vertical.

<>
  <Separator decorative={false} />
  <Inline gap="3">
    <span>Edit</span>
    <Separator orientation="vertical" />
    <span>Archive</span>
  </Inline>
</>

Until 2026-10-18 the default was decorative={false} (the maintainer's decision M35 changed it before 0.1.0).

Static or interactive

Server. It ships no client JavaScript when a Server Component renders it, in every Next.js build mode; its code is bundled only when a client component (a 'use client' file) imports it. How to choose.

In a client app (a Vite or React Router single-page app, or a 'use client' file) it is an ordinary React component: event handlers, refs and state work as usual. In a client app.

Examples

Basic

Decorative is the default (M35, Figma Divider 7370:95): the line between two actions only draws. The rule above the total means something on its own, so it says so with decorative={false} and a screen reader hears a separator there.

Subtotal

Total
Edit
Archive
import type { JSX } from 'react';
import { Inline } from '@nizivo/react/inline';
import { Stack } from '@nizivo/react/stack';
import { Separator } from '@nizivo/react/separator';

export function SeparatorExample(): JSX.Element {
  return (
    <Stack gap="3">
      <div>Subtotal</div>
      <Separator decorative={false} />
      <div>Total</div>
      <Inline gap="3">
        <span>Edit</span>
        <Separator orientation="vertical" />
        <span>Archive</span>
      </Inline>
    </Stack>
  );
}

Props

An <hr>: a 1 px border/subtle line, Figma's Divider (7370:95). Decorative by default; spacing comes first, a line only when spacing is not enough (the Figma doc).

Server component Renders data-slot="separator" with the class nz-separator. Props: SeparatorProps. Source: src/separator/separator.tsx.

NameTypeDefaultDescription
decorativebooleantrue

Purely visual, hidden from assistive technology (role="none"): the Figma Divider default (7370:95, M35). Pass decorative={false} for a separator that means something on its own, a break between two groups a screen reader should hear (an <hr>'s implicit separator role, with aria-orientation when vertical).

orientationOrientation
"horizontal""vertical"
'horizontal'

A vertical separator stretches to the height of its flex row.

renderRenderProp<SeparatorState>–
  • Also takes every attribute of <hr> except children. (Omit<ComponentPropsWithRef<"hr">, "children">)

render takes an element, or, in client code, a function of the props and this state (SeparatorState):

NameTypeDefaultDescription
decorativerequiredboolean–
orientationrequiredOrientation
"horizontal""vertical"
–

Other exports

SeparatorProps type

import type { SeparatorProps } from '@nizivo/react/separator'

The props of Separator, listed above.

SeparatorState type

import type { SeparatorState } from '@nizivo/react/separator'

The render state of Separator, listed above.

Data attributes and slots

Style parts by class (.nz-<slot>) and state by data attribute. Attribute meanings come from contracts/vocabulary.json.

SlotRendered byData attributes
separator
.nz-separator
Separator
root (takes render)
  • data-orientation: "horizontal""vertical" ← orientation
    Layout axis

CSS hooks

Set a hook on the component's class or any ancestor to restyle it without specificity games; leave it unset for the default shown.

HookDefaultRead as
--nz-separator-color--nz-border-subtle
  • border on .nz-separator

Layers: nz.components. Classes: .nz-separator.

Tokens this stylesheet reads (2)

--nz-border-subtle, --nz-border-width-default

Accessibility

Nothing in this component takes focus or keyboard input.

Keyboard

None.

Figma

Node ids from design/component-map.json, which nz gen writes from component.json. The links open the Nizivo Figma library, which may ask you to sign in.

  • Canonical: none
  • Ghost masters: none

On this page