<!-- index: /slotted/llms.txt -->
# divider

`data-ui="divider"` · Line that separates content.

## Minimal example

Example

```tsx
import { Divider } from '@slotted/react/divider';
import { Stack } from '@slotted/react/stack';
import { Heading, Text } from '@slotted/react/typography';

export default function DividerBasic() {
  return (
    <Stack gap={4}>
      <Stack gap={1}>
        <Heading level={2} size="sm">
          Billing
        </Heading>
        <Text size="sm" tone="muted">
          Invoices are issued on the first business day of each month.
        </Text>
      </Stack>
      <Divider />
      <Stack gap={1}>
        <Heading level={2} size="sm">
          Members
        </Heading>
        <Text size="sm" tone="muted">
          Eleven people in the Northwind operations team can approve orders.
        </Text>
      </Stack>
    </Stack>
  );
}
```

## Props

| Name | Type | Default | Applies to | Description |
| --- | --- | --- | --- | --- |
| `orientation` | `'horizontal' \| 'vertical'` | horizontal | Divider | Sets the direction the rule runs in. |
| `decorative` | `boolean` | false | Divider | Removes the rule from the accessibility tree. |
| `inset` | `boolean` | false | Divider | Stops the rule short of both ends of its container. |
| `label` | `string` | — | Divider | Short text that interrupts the rule. It is also the rule’s accessible name. |
| `align` | `'start' \| 'center' \| 'end'` | center | Divider | Sets the position of the label along the rule. |
| `render` | `(props) => ReactNode` | — | Divider | Renders a different root element from the props it receives. |

## Axes and defaults

| Axis | Values | Default |
| --- | --- | --- |
| `orientation` | `horizontal`, `vertical` | `horizontal` |
| `align` | `start`, `center`, `end` | `center` |

## Rules

- The plain rule is an hr, which already exposes the separator role, so the component writes no role of its own.
- A vertical rule receives aria-orientation, because a separator is horizontal unless it says otherwise.
- decorative sets role="none". Use it when the rule groups content visually and a screen reader user loses nothing by not hearing it.
- A labelled rule renders a div, because an hr takes no content. Its name comes from aria-label: the separator role makes its children presentational, so the visible label alone would leave the rule announced as empty.
- A decorative rule carries no name, because role="none" prohibits one. Its label is read in document order, like any other text.
- A rule rendered into another element — the li a menu separator has to be — receives role="separator", because only the hr carries that meaning by itself.
- A role or an aria-label you pass is kept, so a rule that has to say something else keeps saying it.

## Tokens

`--slotted-border-subtle`, `--slotted-border-width-thin`, `--slotted-control-padding-inline-md`, `--slotted-divider-color`, `--slotted-divider-gap`, `--slotted-divider-inset`, `--slotted-divider-label-color`, `--slotted-divider-min-length`, `--slotted-divider-thickness`, `--slotted-font-family-sans`, `--slotted-font-size-xs`, `--slotted-font-weight-medium`, `--slotted-line-height-xs`, `--slotted-space-4`, `--slotted-space-5`, `--slotted-text-muted`

## Examples

### Separating two regions

Excerpt — not a complete module

```tsx
<section>
  <h2>Billing</h2>
  <Divider />
  <h2>Members</h2>
</section>;
```

### A vertical rule between groups of controls

Excerpt — not a complete module

```tsx
<div className="toolbar">
  <Button>Bold</Button>
  <Divider orientation="vertical" />
  <Button>Align left</Button>
</div>;
```

### A rule interrupted by a label

Excerpt — not a complete module

```tsx
<>
  <SignInWithGoogle />
  <Divider label="Or" />
  <EmailAndPassword />
</>;
```

### A separator between two groups of menu items

Excerpt — not a complete module

```tsx
<ul role="menu">
  <li role="menuitem">Rename</li>
  <Divider inset render={(props) => <li {...props} />} />
  <li role="menuitem">Delete</li>
</ul>;
```

### align.tsx

Example

```tsx
import { Divider } from '@slotted/react/divider';
import { Stack } from '@slotted/react/stack';
import { Text } from '@slotted/react/typography';

export default function DividerAlign() {
  return (
    <Stack gap={3}>
      <Divider align="start" label="Today" />
      <Text size="sm">3 shipments left the Rotterdam warehouse.</Text>
      <Divider align="center" label="Yesterday" />
      <Text size="sm">5 shipments left, 1 was returned.</Text>
      <Divider align="end" label="Earlier this week" />
      <Text size="sm">11 shipments left, all delivered.</Text>
    </Stack>
  );
}
```

### decorative.tsx

Example

```tsx
import { Card, CardBody, CardHeader } from '@slotted/react/card';
import { Divider } from '@slotted/react/divider';
import { Stack } from '@slotted/react/stack';
import { Heading, Text } from '@slotted/react/typography';

export default function DividerDecorative() {
  return (
    <Stack gap={4}>
      {[false, true].map((decorative) => (
        <Card key={String(decorative)}>
          <CardHeader>
            <Heading level={2} size="sm">
              {decorative ? 'decorative' : 'Announced'}
            </Heading>
          </CardHeader>
          <CardBody>
            <Stack gap={3}>
              <Text>Order 20418 was packed.</Text>
              <Divider decorative={decorative} />
              <Text>Order 20418 was handed to the carrier.</Text>
              <Divider decorative={decorative} label="Delivery" />
              <Text>Order 20418 is due on Thursday.</Text>
            </Stack>
          </CardBody>
        </Card>
      ))}
    </Stack>
  );
}
```

### inset.tsx

Example

```tsx
import { Button } from '@slotted/react/button';
import { Card, CardBody, CardHeader } from '@slotted/react/card';
import { Divider } from '@slotted/react/divider';
import { Stack } from '@slotted/react/stack';
import { Heading } from '@slotted/react/typography';

const CARRIERS = ['Northwind Freight', 'Harbor Line', 'Alpine Express'];

export default function DividerInset() {
  return (
    <Stack gap={4}>
      {[false, true].map((inset) => (
        <Card key={String(inset)}>
          <CardHeader>
            <Heading level={2} size="sm">
              {inset ? 'inset' : 'Full length'}
            </Heading>
          </CardHeader>
          <CardBody>
            <Stack gap={2}>
              {CARRIERS.map((carrier, index) => [
                index > 0 && <Divider inset={inset} key={`rule-${carrier}`} />,
                <Button fullWidth justify="between" key={carrier} tone="secondary" variant="ghost">
                  {carrier}
                </Button>,
              ])}
            </Stack>
          </CardBody>
        </Card>
      ))}
    </Stack>
  );
}
```

### label.tsx

Example

```tsx
import { Divider } from '@slotted/react/divider';
import { Stack } from '@slotted/react/stack';
import { Text } from '@slotted/react/typography';

export default function DividerLabel() {
  return (
    <Stack gap={4}>
      <Text>Pay with the card on file, ending in 4242.</Text>
      <Divider label="Or" />
      <Text>Send a bank transfer to Northwind Freight, reference INV-20418.</Text>
    </Stack>
  );
}
```

### orientation.tsx

Example

```tsx
import { Divider } from '@slotted/react/divider';
import { Inline } from '@slotted/react/inline';
import { Stack } from '@slotted/react/stack';
import { Text } from '@slotted/react/typography';

export default function DividerOrientation() {
  return (
    <Stack gap={6}>
      <Stack gap={3}>
        <Text size="sm" tone="muted">
          horizontal
        </Text>
        <Text>42 open orders</Text>
        <Divider orientation="horizontal" />
        <Text>17 shipped today</Text>
      </Stack>
      <Stack gap={3}>
        <Text size="sm" tone="muted">
          vertical
        </Text>
        <Inline gap={4}>
          <Text>42 open orders</Text>
          <Divider orientation="vertical" />
          <Text>17 shipped today</Text>
        </Inline>
      </Stack>
    </Stack>
  );
}
```

### values.tsx

Example

```tsx
import { Card, CardBody } from '@slotted/react/card';
import { Divider } from '@slotted/react/divider';
import { Inline } from '@slotted/react/inline';
import { Stack } from '@slotted/react/stack';
import { Text } from '@slotted/react/typography';

const FIGURES = [
  { label: 'Orders', value: '1,284' },
  { label: 'Revenue', value: '$48,200' },
  { label: 'Returns', value: '2.1%' },
];

export default function DividerValues() {
  return (
    <Card>
      <CardBody>
        <Inline gap={6}>
          {FIGURES.flatMap((figure, index) => [
            index > 0 ? (
              <Divider decorative key={`rule-${figure.label}`} orientation="vertical" />
            ) : null,
            <Stack gap={1} key={figure.label}>
              <Text size="sm" tone="muted">
                {figure.label}
              </Text>
              <Text numeric="tabular" size="3xl" weight="semibold">
                {figure.value}
              </Text>
            </Stack>,
          ])}
        </Inline>
      </CardBody>
    </Card>
  );
}
```

### vertical-label.tsx

Example

```tsx
import { Divider } from '@slotted/react/divider';
import { Inline } from '@slotted/react/inline';
import { Stack } from '@slotted/react/stack';
import { Text } from '@slotted/react/typography';

export default function DividerVerticalLabel() {
  return (
    <Inline gap={4}>
      <Stack gap={1}>
        <Text weight="semibold">Pay by card</Text>
        <Text size="sm" tone="muted">
          Charged today
        </Text>
        <Text size="sm" tone="muted">
          Receipt by email
        </Text>
      </Stack>
      <Divider label="Or" orientation="vertical" />
      <Stack gap={1}>
        <Text weight="semibold">Pay by transfer</Text>
        <Text size="sm" tone="muted">
          Due in 30 days
        </Text>
        <Text size="sm" tone="muted">
          Reference INV-20418
        </Text>
      </Stack>
    </Inline>
  );
}
```
