# Separator

> A static line that divides content or action groups.

```tsx title="hero.tsx"
import { Separator } from '@langgenius/dify-ui/separator'

export function SeparatorHeroDemo() {
  return (
    <div className="flex w-full max-w-80 flex-col">
      <div className="flex flex-col gap-1">
        <p className="system-sm-semibold text-text-primary">Retrieval</p>
        <p className="system-xs-regular text-text-tertiary">Top K 4, score threshold 0.5</p>
      </div>
      <Separator className="my-3" />
      <div className="flex flex-col gap-1">
        <p className="system-sm-semibold text-text-primary">Rerank model</p>
        <p className="system-xs-regular text-text-tertiary">Cohere rerank-multilingual-v3.0</p>
      </div>
    </div>
  )
}
```

## Usage guidelines

- **Separate meaningful groups**: By default `Separator` exposes `role="separator"` and its orientation, for a boundary between content or action groups.
- **Mark ornaments decorative**: Set `decorative` on a purely visual line, such as a title ornament or a skeleton line. It renders `role="none"` and exposes no orientation.
- **Keep labels outside the line**: Descendants of `role="separator"` are presentational, so headings and labels sit beside the separator, not inside it.
- **Use the menu's own separator inside menus**: A menu, select or combobox popup uses the separator part of its own family.
- **Do not build a resize handle from it**: `Separator` stays out of the tab order and has no value or keyboard interaction. It needs no accessible name.
- **Own spacing and length in the layout**: The line is 1px thick with no margins. Width sets the length of a horizontal line, height sets the length of a vertical one, and margins come from `className` or the parent's gap.
- **Change color through tokens**: Use a background token for a solid line and a gradient-start token for a gradient line. Use `variant="gradient"` instead of repeating the gradient classes.

## Anatomy

```tsx
import { Separator } from '@langgenius/dify-ui/separator'
```

```tsx
<Separator />
```

## Examples

### Vertical

Set `orientation="vertical"` and give the line a height. Here it divides editing tools from publishing actions in a toolbar.

```tsx title="vertical.tsx"
import { Button } from '@langgenius/dify-ui/button'
import { Separator } from '@langgenius/dify-ui/separator'

export function SeparatorVerticalDemo() {
  return (
    <div className="flex flex-wrap items-center justify-center gap-1.5">
      <Button variant="ghost" size="small">
        Undo
      </Button>
      <Button variant="ghost" size="small">
        Redo
      </Button>
      <Separator orientation="vertical" className="mx-0.5 h-4" />
      <Button variant="secondary" size="small">
        Preview
      </Button>
      <Button variant="primary" size="small">
        Publish
      </Button>
    </div>
  )
}
```

### Decorative gradient

`variant="gradient"` fades from left to right. The direction is physical, so the line fades toward the right in a right-to-left layout too. Beside a section title the line is an ornament, so it is `decorative`.

```tsx title="decorative-gradient.tsx"
import { Separator } from '@langgenius/dify-ui/separator'

export function SeparatorDecorativeGradientDemo() {
  return (
    <div className="flex w-full max-w-80 items-center gap-2">
      <span className="shrink-0 system-xs-semibold-uppercase text-text-tertiary">Variables</span>
      <Separator decorative variant="gradient" className="flex-1" />
    </div>
  )
}
```

## API reference

### Separator

A horizontal or vertical divider between content groups. Renders a `<div>` element.

**Props**

| Prop          | Type                    | Default   | Description                                                                                                                   |
| ------------- | ----------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `decorative?` | `boolean`               | `false`   | Whether the line is purely visual and hidden from assistive technology. Set it for lines that do not separate content groups. |
| `variant?`    | `'gradient' \| 'solid'` | `'solid'` | The line style; `'gradient'` fades out toward the right.                                                                      |

Inherits `orientation`, `className`, `render`, `style` from [Base UI Separator](https://base-ui.com/react/components/separator).

**Data attributes**

| Attribute          | Description                                 |
| ------------------ | ------------------------------------------- |
| `data-orientation` | Indicates the orientation of the separator. |
