# Divider

A thin line that splits content into groups.

```tsx
import { Divider } from '@halo-ds/react';
```

## When to use it
Use a divider to separate groups that belong apart: sections of a page, sets of options in a menu, or items in a long list. Add a short label to name what comes next, like "Earlier", or to offer a choice, like "Or". Use space instead when it already makes the groups clear; too many lines make a page feel busy.

## Do
- Use a divider when groups would otherwise run together.
- Keep labels to one or two words.
- Use Subtle for most lines, and Strong only for big breaks.
- Let horizontal dividers fill their container.

## Don't
- Put a line between every item when space would do.
- Place a divider right next to a border or another divider.
- Use a divider just for decoration.
- Write a sentence in the label.

## Divider or space?
Space is often enough. Reach for a line only when it makes the page easier to scan.
- **Use a divider**: Groups sit close together and could be read as one. Items in a list or menu need a clear edge between them. A short label helps, like "Or" or a date.
- **Use space instead**: Headings or cards already show where each group starts. The line would sit right next to a border or another line. The page already feels busy.

## Props
### Divider props
| Prop | Type | What it does |
| --- | --- | --- |
| `orientation` | `"vertical" \| "horizontal" \| undefined` | A line across, or a line between items in a row. Figma: Orientation. |
| `label` | `ReactNode` | Optional text in the line, like "or". Figma: Label. |
| `labelPosition` | `"center" \| "start" \| undefined` | Where the label sits. Figma: Label position. |
| `color` | `"subtle" \| "strong" \| undefined` | subtle uses border/secondary, strong uses border/strong. Figma: Color. |
| `variant` | `"solid" \| "dashed" \| undefined` | Figma: Style. |
| `classNames` | `Partial<Record<DividerPart, string>> \| undefined` | Extra class names for the parts inside the component, by part name, like `{ header: 'my-header' }`. |
| `styles` | `Partial<Record<DividerPart, CSSProperties>> \| undefined` | Inline styles for the parts inside the component, by part name, like `{ footer: { gap: 4 } }`. |
It also takes the usual HTML attributes for its element.

## Examples
### Overview
```tsx
import { Divider, Text } from '@halo-ds/react';

export default function Example() {
  return (
    <div style={{ display: 'grid', gap: 16, width: 360 }}>
      <Text>Sign in with your email</Text>
      <Divider label="or" />
      <Text>Continue with Google</Text>
    </div>
  );
}
```

### Styles
Subtle and strong, solid and dashed, and a label at the start.
```tsx
import { Divider } from '@halo-ds/react';

export default function Demo() {
  return (
    <div className="demo-stack" style={{ width: 360, gap: 20 }}>
      <Divider />
      <Divider color="strong" />
      <Divider variant="dashed" />
      <Divider label="Section" labelPosition="start" />
    </div>
  );
}
```

### Vertical
A line between items in a row.
```tsx
import { Divider } from '@halo-ds/react';

export default function Demo() {
  return (
    <div className="demo-row" style={{ height: 24 }}>
      Edit <Divider orientation="vertical" /> Share <Divider orientation="vertical" /> Delete
    </div>
  );
}
```

More: https://halodesignsystem.dev/components/divider
