# Separator
A one-pixel line dividing content, horizontal or vertical.
Source page: https://dinachi.dev/docs/components/separator

## Installation
```bash
npx @dinachi/cli@latest add separator
```
Adds to your project:
- `components/ui/separator/separator.tsx`
- `components/ui/separator/index.ts`
Installs:
- `@base-ui/react` ^1.9.0

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

export function Section() {
  return (
    <div>
      <p>Account</p>
      <Separator className="my-4" />
      <p>Billing</p>
    </div>
  )
}
```

## Examples

### Default
Divides a heading from a row of links.
```tsx
import { Separator } from '@/components/ui/separator';

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

### Orientations
Horizontal and vertical lines.
```tsx
import { Separator } from '@/components/ui/separator';

export function Example() {
  return (
    <div className="space-y-6 w-full max-w-sm">
      <div>
        <p className="text-sm font-medium mb-2">Horizontal</p>
        <Separator />
      </div>
      <div className="flex items-center space-x-4 h-8">
        <span className="text-sm">Item A</span>
        <Separator orientation="vertical" />
        <span className="text-sm">Item B</span>
        <Separator orientation="vertical" />
        <span className="text-sm">Item C</span>
      </div>
    </div>
  );
}
```

## Notes

### Vertical height
A vertical separator is `h-full`. Give the row a height, as in `<div className="flex h-5 items-center">`, or the line collapses.

### Decorative lines
Separator always has the separator role. For a purely visual line, use a styled `div` so screen readers skip it.

## API reference

### Separator
The line.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Horizontal fills the width; vertical fills the height. |
| `render` | `ReactElement` | - | Swap the element, keep the behaviour. |

## Accessibility
- Renders with the separator role and aria-orientation set from `orientation`.

## Source
`components/ui/separator/separator.tsx`
```tsx
"use client"

import * as React from "react"
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
import { cn } from "@/lib/utils"

const Separator = React.forwardRef<
  React.ComponentRef<typeof SeparatorPrimitive>,
  React.ComponentPropsWithoutRef<typeof SeparatorPrimitive>
>(({ className, orientation = "horizontal", ...props }, ref) => (
  <SeparatorPrimitive
    data-slot="separator"
    ref={ref}
    orientation={orientation}
    className={cn(
      "shrink-0 bg-border",
      orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
      className
    )}
    {...props}
  />
))
Separator.displayName = "Separator"

export { Separator }
```
