# Separator

Visually or semantically separates content.

## Installation

```bash
npx shadcn@latest add https://reactdocs.canceydejean.dev/r/separator.json
```

[Registry JSON](https://reactdocs.canceydejean.dev/r/separator.json)

## Preview

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

export function Preview() {
  return (
    <div className="w-full max-w-sm space-y-1">
      <div className="space-y-1">
        <h4 className="text-sm leading-none font-medium">Radix Primitives</h4>
        <p className="text-sm text-muted-foreground">An open-source UI component library.</p>
      </div>
      <Separator className="my-4" />
      <div className="flex h-5 items-center gap-4 text-sm">
        <div>Blog</div>
        <Separator orientation="vertical" />
        <div>Docs</div>
        <Separator orientation="vertical" />
        <div>Source</div>
      </div>
    </div>
  );
}
```


## Source

### separator.tsx

```tsx
"use client";

import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";

import { cn } from "cn";

function Separator({
  className,
  orientation = "horizontal",
  ...props
}: SeparatorPrimitive.Props) {
  return (
    <SeparatorPrimitive
      data-slot="separator"
      orientation={orientation}
      className={cn(
        "bg-border shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
        className,
      )}
      {...props}
    />
  );
}

export { Separator };
```



## Usage

Use a separator to divide content groups horizontally or vertically.

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

export function Example() {
  return (
    <div>
      <div>Section one</div>
      <Separator className="my-4" />
      <div>Section two</div>
    </div>
  );
}
```

Pass `orientation="vertical"` for an upright divider.

