nook
Browse the docs

Components

Separator

Built on Base UI

A line between groups of content, horizontal or vertical.

See the prompt

Pizza night at Maya's

Friday, 13 November

4 people$96 totalPaid

Installation

npx nook-ui@latest add separator

Prompt

Paste this into your AI coding assistant. It adds this exact component, the same way the CLI does, and tells the assistant how to use it.

Short. For assistants that can run commands in your project.

Plain text
Add the Nook "Separator" component to this project, exactly as Nook ships it.

A line between groups of content, horizontal or vertical.

Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add separator`. It writes `components/ui/separator.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/separator.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:

```tsx
import { Separator } from "@/components/ui/separator";

export default function SeparatorDefault() {
  return (
    <div className="grid w-full max-w-sm gap-3 text-sm">
      <div>
        <p className="font-medium">Pizza night at Maya's</p>
        <p className="text-muted-foreground">Friday, 13 November</p>
      </div>
      <Separator />
      <div className="flex h-5 items-center gap-3 text-muted-foreground">
        <span>4 people</span>
        <Separator orientation="vertical" />
        <span>$96 total</span>
        <Separator orientation="vertical" />
        <span>Paid</span>
      </div>
    </div>
  );
}
```

API
- `Separator`: The line.
- Variant `orientation`: horizontal, vertical (default horizontal)

Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: Renders role=separator with its orientation. Use it between groups, not as decoration inside a group.

Done when the component renders like the example in light and dark mode and the project type-checks.

Usage

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

export default function SeparatorDefault() {
  return (
    <div className="grid w-full max-w-sm gap-3 text-sm">
      <div>
        <p className="font-medium">Pizza night at Maya's</p>
        <p className="text-muted-foreground">Friday, 13 November</p>
      </div>
      <Separator />
      <div className="flex h-5 items-center gap-3 text-muted-foreground">
        <span>4 people</span>
        <Separator orientation="vertical" />
        <span>$96 total</span>
        <Separator orientation="vertical" />
        <span>Paid</span>
      </div>
    </div>
  );
}

Examples

Vertical

DocsChangelogStatus

With a label

or

Between sections

Order summary

Order #4821

2 × Linen shirt
$96.00
Shipping
$6.00
Total$102.00

Variants

Defined in one place with cva, at the top of the component file.

  • orientation

    horizontal (default)vertical

Props

Separator

The line.

Accessibility

Renders role=separator with its orientation. Use it between groups, not as decoration inside a group.

Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.