# Separator

> A visual divider that separates content horizontally or vertically, with optional Material 3 inset spacing.

Canonical URL: https://taut-ui.com/docs/components/separator

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

export default function Particle() {
  return (
    <div className="w-72 space-y-4">
      <div className="space-y-1">
        <h4 className="font-medium text-sm">Taut UI</h4>
        <p className="text-muted-foreground text-sm">
          Beautiful components built with Base UI.
        </p>
      </div>
      <Separator />
      <div className="flex h-5 items-center gap-4 text-sm">
        <span>Blog</span>
        <Separator orientation="vertical" />
        <span>Docs</span>
        <Separator orientation="vertical" />
        <span>GitHub</span>
      </div>
    </div>
  );
}
```

## Installation [#installation]

**CLI**

```bash
npx shadcn@latest add https://taut-ui.com/r/separator.json
```

**Manual**

- Install the following dependencies:

```bash
npm install @base-ui/react class-variance-authority
```

- Copy and paste the following code into your project.

```tsx title="components/ui/separator.tsx"
"use client";

import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
import { cva, type VariantProps } from "class-variance-authority";
import type React from "react";
import { cn } from "@/lib/utils";

export const separatorVariants = cva(
  "shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-[calc(100%-var(--inset,0rem))] data-[orientation=vertical]:w-px data-[orientation=vertical]:not-[[class^='h-']]:not-[[class*='_h-']]:self-stretch",
  {
    variants: {
      inset: {
        both: "[--inset:2rem] data-[orientation=horizontal]:mx-4 data-[orientation=vertical]:my-4",
        end: "[--inset:1rem] data-[orientation=horizontal]:me-4 data-[orientation=vertical]:mb-4",
        start:
          "[--inset:1rem] data-[orientation=horizontal]:ms-4 data-[orientation=vertical]:mt-4",
      },
    },
  },
);

export type SeparatorProps = SeparatorPrimitive.Props &
  VariantProps<typeof separatorVariants>;

export function Separator({
  className,
  orientation = "horizontal",
  inset,
  ...props
}: SeparatorProps): React.ReactElement {
  return (
    <SeparatorPrimitive
      className={cn(separatorVariants({ inset }), className)}
      data-slot="separator"
      orientation={orientation}
      {...props}
    />
  );
}

export { SeparatorPrimitive };
```

- Update the import paths to match your project setup.

## Usage [#usage]

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

```tsx
<div className="space-y-4">
  <p>Above the separator</p>
  <Separator />
  <p>Below the separator</p>
</div>
```

## Examples [#examples]

### Inset [#inset]

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

const items = [
  { description: "Manage your personal details", title: "Account" },
  { description: "Configure alerts and digests", title: "Notifications" },
  { description: "Manage active sessions and keys", title: "Security" },
];

export default function Particle() {
  return (
    <Card className="w-72 py-1">
      {items.map((item, index) => (
        <div key={item.title}>
          <div className="px-4 py-3">
            <p className="font-medium text-foreground text-sm">{item.title}</p>
            <p className="text-muted-foreground text-xs">{item.description}</p>
          </div>
          {index < items.length - 1 && <Separator inset="both" />}
        </div>
      ))}
    </Card>
  );
}
```

### Start Inset [#start-inset]

```tsx
import { BellIcon, ShieldIcon, UserIcon } from "lucide-react";
import { Card } from "@/components/ui/card";
import { Separator } from "@/components/ui/separator";

const items = [
  { icon: UserIcon, label: "Profile" },
  { icon: BellIcon, label: "Notifications" },
  { icon: ShieldIcon, label: "Privacy & Security" },
];

export default function Particle() {
  return (
    <Card className="w-72 py-1">
      {items.map((item, index) => (
        <div key={item.label}>
          <div className="flex items-center gap-3 px-4 py-3 text-foreground text-sm">
            <item.icon className="size-4 shrink-0 text-muted-foreground" />
            <span>{item.label}</span>
          </div>
          {index < items.length - 1 && <Separator inset="start" />}
        </div>
      ))}
    </Card>
  );
}
```

## API Reference [#api-reference]

### Separator [#separator]

Wraps Base UI `Separator` with horizontal/vertical orientation and optional inset margins.

| Prop          | Type                         | Default        | Description                                                         |
| ------------- | ---------------------------- | -------------- | ------------------------------------------------------------------- |
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Axis of the divider line                                            |
| `inset`       | `"both" \| "start" \| "end"` | -              | Insets the divider from both ends, the leading end, or trailing end |
| `className`   | `string`                     | -              | Additional CSS classes                                              |
| `...props`    | Base UI Separator props      | -              | All standard separator attributes are supported                     |
