# Separator

A thin dividing line, horizontal or vertical, solid or dashed.

- Category: Core Elements
- Page: https://wunderui.com/components/separator
- Tier: Free

## Install

```bash
npx wunderui-cli add separator
```

## Import

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

## Minimal usage

Then use it:

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

export function Workspace() {
  return (
    <div className="w-80 text-sm">
      <p className="font-medium text-foreground">Workspace</p>
      <Separator className="my-4" />
      <p className="text-text-secondary">Members, billing and security.</p>
    </div>
  )
}
```

Expected result: You see a line of text, a 1 px line across the full 320 px width with 16 px of space above and below it, and a second line of text.

## Usage

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

export function Example() {
  return (
    <div className="w-80 max-w-full text-sm">
      <p className="font-medium text-foreground">Workspace</p>
      <p className="text-text-secondary">WunderUI · info@wunderui.com</p>
      <Separator className="my-4" />
      <p className="text-text-secondary">Members, billing and security.</p>
    </div>
  )
}
```

## When to use

### Use Separator for

- Dividing groups of content inside one surface, such as two sections of a card or the rows of a list
- Setting inline items apart in a row, such as links, figures or toolbar groups
- A lighter dashed break inside one section, such as the line above a total

### Use something else

- [Divider with Label](https://wunderui.com/components/divider-with-label) for a line with a word, a button or an icon on it, such as or between two ways to sign in
- [Toolbar](https://wunderui.com/components/toolbar) for a row of actions, which has its own ToolbarSeparator for splitting groups
- [Card](https://wunderui.com/components/card) for a group that deserves its own surface instead of a line around it

## Behavior

What the separator does with length, style, semantics and motion.

- **Length:** A horizontal separator is 1 px high and full width, a vertical one 1 px wide and as tall as its flex row, so put it in a row with a height. It never collapses.
- **Style:** Solid fills the line with the border colour. Dashed draws a 1 px dashed border in the same colour, on the top for horizontal and the left for vertical.
- **Semantics:** Base UI renders a div with the separator role and sets the orientation. Horizontal is the default and vertical is announced as such, and the line is not focusable.
- **Decorative:** There is no decorative prop. Pass a presentation role and aria-hidden to remove the line from the accessibility tree, as Divider with Label does.
- **Spacing:** The separator has no margin. Use a vertical margin between stacked blocks, padding on list rows and a gap in a row, so one rule sets the air for every line.
- **Theme:** The colour is the border token in both styles, so the line follows the theme and dark mode with no extra class.
- **Motion:** The separator has no state and no transition. Nothing in it moves.
- **Reduced motion:** There is no animation to reduce, so reduced motion changes nothing.

## Anatomy

- `Separator`: A 1 px line, horizontal by default and as wide as its container, or vertical and as tall as its row. It can be dashed, never shrinks in a flex row and has no margin.

## Best practices

### When to use

- Use it to divide groups inside one surface, such as two sections of a card. For a line with text like or use Divider with Label, and inside a toolbar use ToolbarSeparator.

### Do

- Place a vertical Separator in a flex row that has a height. It stretches to the row, so without one the line has nothing to stretch to.
- Use the dashed style for a lighter break inside one section, such as the line above a total, and the solid line between sections.
- Leave the spacing to the layout: a vertical margin between sections, padding on list rows, and a gap in a row.
- Make the line decorative when a heading, list or group already shows the boundary. Keep the default when the line is the only sign of it.

### Don't

- Don't draw dividers with a border class or a hex colour. Separator uses the border token, so it follows the theme and dark mode.
- Don't use a Separator as a panel resizer, because it is not focusable and has no value. A resizable layout needs a splitter with keyboard support.
- Don't stack a Separator on a border that is already there, such as the last row of a bordered list or a card edge. Two lines read as one thick one.

## API reference

### Separator

| Prop | Type | Default | Description |
|---|---|---|---|
| className | string \| ((state: State) => string \| undefined) |  | Extra classes for the line, such as a margin (`my-4`) or a fixed length for a vertical line (`data-vertical:h-5`). A function receives the state and returns the classes. |
| dashed | boolean | false | Draws the line as a 1 px dashed border instead of a filled line, for a lighter break inside one section. |
| orientation | "horizontal" \| "vertical" | "horizontal" | `horizontal` runs across the container and is the default. `vertical` runs down a flex row and stretches to its height. It also sets `aria-orientation`. |
| render | React.ReactElement \| ComponentRenderFn<RenderFunctionProps, State> |  | Replaces the `<div>` with another element or component, for example `render={<hr />}`. The role and the orientation attribute are still set on it. |
| style | React.CSSProperties \| ((state: State) => React.CSSProperties \| undefined) |  | Inline styles for the line. A function receives the state, which holds the orientation, and returns the styles. |

Also accepts React.HTMLAttributes attributes.

## Examples

### Orientation: horizontal, or vertical in a row with a height

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

export function Example() {
  return (
    <div className="w-80 max-w-full text-sm">
      <p className="font-medium text-foreground">Workspace</p>
      <p className="text-text-secondary">WunderUI · info@wunderui.com</p>
      <Separator className="my-4" />
      <p className="text-text-secondary">Members, billing and security.</p>
    </div>
  )
}
```

### Style: solid or dashed

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

export function Example() {
  return (
    <div className="w-80 max-w-full text-sm">
      <p className="font-medium text-foreground">Team plan</p>
      <p className="text-text-secondary">3 seats, billed monthly</p>
      <Separator className="my-4" />
      <p className="font-medium text-foreground">Payment method</p>
      <p className="text-text-secondary">Visa ending in 4242</p>
    </div>
  )
}
```

### Semantics: announced as a separator, or decorative

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

export function Example() {
  return (
    <div className="w-80 max-w-full text-sm">
      <h3 className="font-medium text-foreground">Notifications</h3>
      <p className="text-text-secondary">Choose what reaches your inbox.</p>
      <Separator className="my-4" />
      <h3 className="font-medium text-foreground">Security</h3>
      <p className="text-text-secondary">Two-factor authentication and sessions.</p>
    </div>
  )
}
```

### Spacing in layouts: between sections, list rows and toolbar groups

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

export function Example() {
  return (
    <div className="w-80 max-w-full text-sm">
      <p className="font-medium text-foreground">Workspace</p>
      <p className="text-text-secondary">WunderUI · info@wunderui.com</p>
      <Separator className="my-4" />
      <p className="text-text-secondary">Members, billing and security.</p>
    </div>
  )
}
```

## In context

### Reset password: a plain line between the heading and the form

The line separates the heading from the form inside one card. It sits between the parts, so the card keeps its 16 px gap on both sides.

```tsx
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Separator } from "@/components/ui/separator"

export function Example() {
  return (
    <Card className="w-96 max-w-full">
      <CardHeader>
        <CardTitle>Reset password</CardTitle>
        <CardDescription>Enter your email to reset your password.</CardDescription>
      </CardHeader>
      <Separator />
      <CardContent className="flex flex-col gap-4">
        <div className="flex flex-col gap-2">
          <Label htmlFor="reset-email">Email address</Label>
          <Input id="reset-email" type="email" placeholder="info@wunderui.com" />
        </div>
        <Button variant="gradient" className="w-full">
          Send reset link
        </Button>
      </CardContent>
    </Card>
  )
}
```

### Order summary: a solid line under the heading and a dashed one above the total

The dashed line marks the sum inside the list of charges. Switch the billing period to see the figures change.

```tsx
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"

export function Example() {
  return (
    <Card className="w-96 max-w-full">
      <CardHeader>
        <CardTitle>Order summary</CardTitle>
        <CardDescription>Team plan, billed monthly</CardDescription>
      </CardHeader>
      <Separator />
      <CardContent className="flex flex-col gap-3 text-sm">
        <div className="flex justify-between text-text-secondary">
          <span>3 seats at $24.00</span>
          <span>$72.00</span>
        </div>
        <div className="flex justify-between text-text-secondary">
          <span>Tax (10 %)</span>
          <span>$7.20</span>
        </div>
        <Separator dashed />
        <div className="flex justify-between font-medium text-foreground">
          <span>Total</span>
          <span>$79.20</span>
        </div>
      </CardContent>
    </Card>
  )
}
```

### Profile: three figures split by vertical lines

Each vertical line is a fixed 40 px and centred in the row, so the figures keep their own height.

```tsx
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"

export function Example() {
  return (
    <Card className="w-96 max-w-full">
      <CardHeader>
        <CardTitle>Nora Lindgren</CardTitle>
        <CardDescription>Product designer at WunderUI</CardDescription>
      </CardHeader>
      <Separator />
      <CardContent className="flex items-center justify-between gap-4">
        <div className="flex flex-col">
          <span className="text-xs text-text-secondary">Projects</span>
          <span className="text-lg font-semibold text-foreground">24</span>
        </div>
        <Separator orientation="vertical" className="data-vertical:h-10 data-vertical:self-center" />
        <div className="flex flex-col">
          <span className="text-xs text-text-secondary">Followers</span>
          <span className="text-lg font-semibold text-foreground">1,842</span>
        </div>
        <Separator orientation="vertical" className="data-vertical:h-10 data-vertical:self-center" />
        <div className="flex flex-col">
          <span className="text-xs text-text-secondary">Reviews</span>
          <span className="text-lg font-semibold text-foreground">312</span>
        </div>
      </CardContent>
    </Card>
  )
}
```

## For AI agents

`get_component("separator")`

Hand your agent this page as Markdown or the WunderUI MCP server, not a screenshot.
