# Separator

A gently wandering pen rule, horizontal or vertical.

Docs: https://ballpoint.st9wd.com/docs/separator

```bash
npx shadcn@latest add @ballpoint/separator
```

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

<Separator />
<Separator orientation="vertical" />
```

Props:

- `orientation`: `"horizontal" | "vertical"` (default `"horizontal"`). Which way the rule runs.
- `delay`: `number` (default `0`). ms after the pen gets to it before the rule is drawn. Rising delays rule a list off one line after another.
- `children`: `ReactNode`. If given, written in the middle of a rule that runs both sides of it. The wrapper is the separator for assistive technology.
- `seed`: `string | number`. Pins the drawing.

Pen settings: `draw`, `weight`, `speed` (see Pen settings).

Every other prop goes to Base UI's Separator: https://base-ui.com/react/components/separator

## Example

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

export default function SeparatorDemo() {
  return (
    <div className="w-full max-w-sm">
      <p className="text-lg font-bold">Ballpoint</p>
      <p className="text-ink-3">Components drawn in blue ballpoint.</p>
      <Separator className="my-4" seed="sep-h" />
      <div className="flex h-6 items-center gap-4">
        <span>Docs</span>
        <Separator orientation="vertical" seed="sep-v1" />
        <span>Components</span>
        <Separator orientation="vertical" seed="sep-v2" />
        <span>Source</span>
      </div>
    </div>
  );
}
```

## Between sections

Rules that divide a settings page, with the danger zone last.

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

export default function SeparatorSections() {
  return (
    <div className="flex w-full max-w-md flex-col gap-5">
      <section>
        <h3 className="text-lg font-bold">Account</h3>
        <p className="text-ink-3">Your name and email.</p>
      </section>
      <Separator seed="ss-1" />
      <section>
        <h3 className="text-lg font-bold">Notebooks</h3>
        <p className="text-ink-3">Where your pages live.</p>
      </section>
      <Separator seed="ss-2" />
      <section>
        <h3 className="text-lg font-bold text-destructive">Danger zone</h3>
        <p className="text-ink-3">Delete everything. There is no undo.</p>
      </section>
    </div>
  );
}
```

## With a label

Write in the middle of a rule: the or between two ways in.

```tsx
"use client";

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

export default function SeparatorLabel() {
  return (
    <div className="flex w-full max-w-sm flex-col gap-5">
      <Button variant="outline" seed="sl-google">
        Continue with a pen name
      </Button>
      <Separator seed="sl-or">or</Separator>
      <form className="flex flex-col gap-3" onSubmit={(event) => event.preventDefault()}>
        <Input type="email" aria-label="Email" placeholder="you@example.com" seed="sl-email" />
        <Button seed="sl-send">Email me a link</Button>
      </form>
    </div>
  );
}
```

## In a toolbar

Vertical rules dividing groups of buttons.

```tsx
import { Button } from "@/components/ui/button";
import { InkIcon } from "@/components/ui/ink-icons";
import { Separator } from "@/components/ui/separator";

export default function SeparatorToolbar() {
  return (
    <div role="toolbar" aria-label="Formatting" className="flex h-9 items-center gap-1">
      <Button variant="ghost" size="icon-sm" seed="st-bold">
        <InkIcon name="bold" />
        <span className="sr-only">Bold</span>
      </Button>
      <Button variant="ghost" size="icon-sm" seed="st-italic">
        <InkIcon name="italic" />
        <span className="sr-only">Italic</span>
      </Button>
      <Button variant="ghost" size="icon-sm" seed="st-underline">
        <InkIcon name="underline" />
        <span className="sr-only">Underline</span>
      </Button>
      <Separator orientation="vertical" seed="st-a" className="mx-2" />
      <Button variant="ghost" size="icon-sm" seed="st-left">
        <InkIcon name="align-left" />
        <span className="sr-only">Align left</span>
      </Button>
      <Button variant="ghost" size="icon-sm" seed="st-center">
        <InkIcon name="align-center" />
        <span className="sr-only">Align centre</span>
      </Button>
      <Separator orientation="vertical" seed="st-b" className="mx-2" />
      <Button variant="ghost" size="icon-sm" seed="st-link">
        <InkIcon name="link" />
        <span className="sr-only">Link</span>
      </Button>
    </div>
  );
}
```

## Pen settings

- `draw`: `"auto" | "mount" | "none"` (default `"auto"`). When the strokes draw themselves in: the first time they scroll into view, as soon as they render, or never (already drawn).
- `weight`: `number` (default `1`). Line weight multiplier. Also settable in CSS as --ink-weight.
- `speed`: `number` (default `1`). Drawing speed multiplier. Also settable in CSS as --ink-speed.
