<!--
Source: https://www.theui.dev/docs/divider
Part of the theui-svelte documentation. Index: https://www.theui.dev/llms.txt
-->

# Divider

The Divider component draws a line between two pieces of content. It can run across or down, carry a label such as 'OR', and use a solid, dashed or dotted line.

## Example

Import the component and drop it between two blocks. On its own it renders a real `<hr>`, so it means something to a screen reader as well as to the eye.

```html
<script>
  import { Divider } from "theui-svelte";
</script>

<p>Everything above the line.</p>
<Divider />
<p>Everything below the line.</p>
```

## Variants

The `variant` prop sets the line style: `solid` (default), `dashed` or `dotted`.

```html
<Divider />
<Divider variant="dashed" />
<Divider variant="dotted" />
```

## Label

Put content inside the component and it is placed in the middle of the line. This is the usual way to write an **OR** between two sign-in options.

```html
<Divider>OR</Divider>
<Divider variant="dashed">Continue below</Divider>
```

## Label Alignment

With a label, the `align` prop decides where it sits: `center` (default), `start` or `end`. The alignment follows the text direction, so it flips on a right to left page.

```html
<Divider align="start">Start</Divider>
<Divider align="center">Center</Divider>
<Divider align="end">End</Divider>
```

## Vertical Divider

Set `orientation="vertical"` to separate items that sit side by side. The divider takes the height of its parent, so place it in a flex row with a height.

```html
<div class="flex h-16 items-center gap-4">
  <span>Profile</span>
  <Divider orientation="vertical" />
  <span>Settings</span>
  <Divider orientation="vertical" variant="dashed" />
  <span>Sign out</span>
</div>
```

## Vertical Label

A vertical divider takes a label too. The line is drawn above and below the text.

```html
<div class="flex h-40 items-center gap-4">
  <span>Sign in</span>
  <Divider orientation="vertical">OR</Divider>
  <span>Create account</span>
</div>
```

## Customization

Use `lineClasses` for the line and `labelClasses` for the text. The `class` prop goes on the element itself, which is where spacing belongs.

```html
<Divider lineClasses="border-brand-500" />
<Divider lineClasses="border-2 border-info-500" variant="dashed" />
<Divider class="my-8" labelClasses="rounded-full bg-brand-500 px-3 py-1 text-xs font-semibold text-on-brand">
  NEW
</Divider>
```

## Accessibility

Without a label the component renders an `<hr>`, or a vertical separator with `aria-orientation="vertical"`, both of which assistive technology understands as a break between sections. With a label, the lines are hidden from screen readers and only the text is read, because a separator cannot hold a name of its own. Decoration alone does not need a divider: if the parts are already separate landmarks or headings, the line adds nothing.

## Configuration

### Props

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `orientation` | [DIVIDER_ORIENTATION](https://www.theui.dev/docs/types#divider-orientation-type) | `horizontal` | Direction of the line: "horizontal" or "vertical". A vertical divider takes the height of its parent. |
| `variant` | [DIVIDER_VARIANT](https://www.theui.dev/docs/types#divider-variant-type) | `solid` | Line style: "solid", "dashed" or "dotted". |
| `align` | [DIVIDER_ALIGN](https://www.theui.dev/docs/types#divider-align-type) | `center` | Where the label sits along the line: "start", "center" or "end". Only used when there is a label. |
| `lineClasses` | string | `` | Custom classes for the line, such as its colour or thickness. |
| `labelClasses` | string | `` | Custom classes for the label. |

### Dynamic props

| Name | Description |
| --- | --- |
| `class` | Classes for the divider element, merged with the default classes. Spacing belongs here. |

### Snippets

| Name | Description |
| --- | --- |
| `children` | Label placed in the middle of the line. Without it the component renders a plain rule. |

---

Category: Components
Keywords: divider, separator, hr, rule, component, svelte, svelte-5, theui-svelte, component-library, ui, tailwindcss
Full documentation set: https://www.theui.dev/llms-full.txt
