# Separator

> Separator for React and shadcn: a 1px divider, horizontal, vertical, inset or labelled like the "or" between sign-in methods.

A 1px rule in Eased's line colours. Horizontal or vertical, inset to a content column, or labelled like the "or" between sign-in methods. Base UI Separator semantics, or decorative.

- Tier: Free (MIT)
- Interaction: Scroll
- Page: https://eased.dev/components/separator
- Installs: @base-ui/react
- Registry: https://eased.dev/r/separator.json

## Install

```bash
npx shadcn add https://eased.dev/r/separator.json
```

Mark a boundary between sections with a 1px rule in Eased's line colours, on Base UI's Separator.

## When to use

- Split a panel into sections where spacing alone doesn't read, such as above a footer.
- Offer alternatives side by side with a labelled rule, like the "or" between sign-in methods.
- Line a rule up with a list's text column, past its icons or avatars, with `inset`.
- Divide items in a toolbar or footer row with a vertical rule.

## When not to use

- Between every row of a list: use a border on the rows (`divide-y`) instead of a component per gap.
- When spacing or a heading already separates the content: add more space, or pass `decorative` if you keep the rule.
- Switching between views: use [Tabs](/components/tabs) or [Segmented](/components/segmented).

## Usage

```tsx sign-in-methods.tsx
import { Button } from "@/components/eased/button/button";
import { Input } from "@/components/eased/input/input";
import { Separator } from "@/components/eased/separator/separator";

export function SignInMethods() {
  return (
    <div className="flex flex-col gap-5">
      <Button className="w-full">Continue with Google</Button>
      <Separator>or</Separator>
      <Input type="email" aria-label="Work email" placeholder="you@company.com" />
    </div>
  );
}
```

## Examples

### Inset to a text column

Use `inset` so the rule starts where a list's text does, after a 32px avatar and its gap.

```tsx
<Separator inset="2.5rem" />
```

### Vertical

Use a vertical rule between items in a row. It stretches to the row's height, so give the row a height or the rule a margin.

```tsx
<div className="flex h-12 items-center gap-3 text-ui-sm text-text-muted">
  <span>SSO available on Business</span>
  <Separator orientation="vertical" decorative className="my-4" />
  <span>SOC 2 Type II</span>
</div>
```

### On a tinted fill

Use `tone="default"` when the rule sits on a sunken or tinted surface, where `subtle` disappears.

```tsx
<Separator tone="default" />
```

## API reference

### Separator

| Prop | Type | Default | Description |
|---|---|---|---|
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | A vertical rule stretches to its row's height. |
| `tone` | `"subtle" \| "default"` | `"subtle"` | `default` reads on sunken or tinted fills. |
| `inset` | `string` | | Leading inset, as a CSS length or variable such as `"2.5rem"`. Horizontal, unlabelled rules only. |
| `decorative` | `boolean` | `false` | Hides the rule from assistive tech. |
| `children` | `ReactNode` | | A label in the middle of the rule, such as "or". Horizontal only. |
| `className` | `string` | `""` | Appended to the root's classes. |

No other props pass through to Base UI's Separator.

## Accessibility

- It renders `role="separator"` with `aria-orientation`, from Base UI.
- A string label names the separator through `aria-label` ("or, separator"), and the visible copy is hidden so it isn't read twice. A non-string label is read as content.
- `decorative` sets `role="none"` and `aria-hidden`. Use it when spacing or a heading already marks the boundary; leave it off when the rule is the only thing that does.

## Responsive

A labelled rule keeps at least 16px of line on each side of its label, so it still reads on a narrow screen. The label itself never shrinks, so keep it to a word or two.

## Motion

None. Rules mark structure; they never animate.

## Notes for AI

Pick Separator for a single boundary between sections, a labelled "or" between alternatives, or a vertical divider in a row. Pass `decorative` whenever the rule is only visual, which is most of the time inside cards and footers.

Don't use it between every list row; put `divide-y divide-line-subtle` on the list instead. Don't pass `inset` with a label or a vertical orientation, where it has no effect, and don't hand-roll a `<hr>` or a `h-px` div: you'd lose the role and the tone tokens.

## Related

- [Tabs](/components/tabs): switch between views rather than divide one.
- [Heading](/components/heading): separate sections with a title instead of a rule.

## Example

`components/eased/separator/separator-demo.tsx`

```tsx
"use client";

import { Button } from "../button/button";
import { Input } from "../input/input";
import { DemoFrame } from "../lib/demo-frame";
import { Separator } from "./separator";

const GitHub = () => (
  <svg viewBox="0 0 16 16" aria-hidden className="size-4 fill-current">
    <path d="M8 .2a8 8 0 0 0-2.53 15.6c.4.07.55-.17.55-.38v-1.4c-2.23.48-2.7-1.07-2.7-1.07-.36-.92-.89-1.17-.89-1.17-.73-.5.06-.49.06-.49.8.06 1.23.83 1.23.83.72 1.22 1.87.87 2.33.66.07-.52.28-.87.5-1.07-1.78-.2-3.65-.89-3.65-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.6 7.6 0 0 1 4 0c1.53-1.03 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.28.82 2.15 0 3.07-1.87 3.75-3.66 3.95.29.25.54.73.54 1.48v2.2c0 .21.15.46.55.38A8 8 0 0 0 8 .2Z" />
  </svg>
);

const Google = () => (
  <svg viewBox="0 0 16 16" aria-hidden className="size-4">
    <path fill="#4285F4" d="M15.68 8.18c0-.57-.05-1.11-.15-1.64H8v3.1h4.3a3.68 3.68 0 0 1-1.6 2.42v2h2.6c1.52-1.4 2.38-3.46 2.38-5.88Z" />
    <path fill="#34A853" d="M8 16c2.16 0 3.97-.72 5.3-1.94l-2.6-2a4.8 4.8 0 0 1-7.14-2.52H.88v2.07A8 8 0 0 0 8 16Z" />
    <path fill="#FBBC05" d="M3.56 9.54a4.8 4.8 0 0 1 0-3.08V4.39H.88a8 8 0 0 0 0 7.22l2.68-2.07Z" />
    <path fill="#EA4335" d="M8 3.18c1.22 0 2.3.42 3.16 1.24l2.3-2.3A8 8 0 0 0 .88 4.39l2.68 2.07A4.77 4.77 0 0 1 8 3.18Z" />
  </svg>
);

/** A sign-in panel: a labelled "or" rule between methods, a plain rule above the footer, a vertical one in it. */
export function SeparatorDemo() {
  return (
    <DemoFrame title="Sign in to Acme">
      <div className="flex min-h-0 flex-1 flex-col justify-center gap-5 px-(--pad) py-4">
        <div className="flex flex-col gap-2">
          <Button className="w-full">
            <Google />
            Continue with Google
          </Button>
          <Button className="w-full">
            <GitHub />
            Continue with GitHub
          </Button>
        </div>
        <Separator>or</Separator>
        <form className="flex flex-col gap-2" onSubmit={(e) => e.preventDefault()}>
          <Input type="email" aria-label="Work email" placeholder="you@company.com" autoComplete="email" />
          <Button variant="primary" type="submit" className="w-full">
            Continue with email
          </Button>
        </form>
      </div>
      <Separator decorative />
      <div className="flex h-12 shrink-0 items-center justify-center gap-3 px-(--pad) text-ui-sm text-text-muted">
        <span>SSO available on Business</span>
        <Separator orientation="vertical" decorative className="my-4" />
        <span className="tabular-nums">SOC 2 Type II</span>
      </div>
    </DemoFrame>
  );
}
```
