# Divider

A thin rule that separates groups of content, horizontally or vertically, optionally with a short label. Prefer spacing alone where it already makes the grouping clear.

- Package: [@vigdx/ui](https://www.npmjs.com/package/@vigdx/ui)
- Selectors: `vig-divider`
- Source: [libs/ui/src/lib/atoms/divider/divider.ts](https://github.com/bakyurekk/vigdx/blob/main/libs/ui/src/lib/atoms/divider/divider.ts)

```typescript title="Import"
import { Divider } from '@vigdx/ui/divider';
```

## Basic

A horizontal divider spans the width of its container.

```typescript title="divider-basic.ts"
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Divider } from '@vigdx/ui/divider';

@Component({
  selector: 'app-divider-basic',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Divider],
  template: `
    <div class="flex max-w-md flex-col gap-4 text-sm text-foreground">
      <p>Order #20418 was shipped on 4 November.</p>
      <vig-divider />
      <p>Delivery is expected within two to three working days.</p>
    </div>
  `,
})
export class DividerBasicDemo {}
```

## With a label

`label` puts short text inside the rule; `align` places it at the `start`, `center` (default) or `end`, following the text direction.

```typescript title="divider-label.ts"
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Button } from '@vigdx/ui/button';
import { Divider } from '@vigdx/ui/divider';

@Component({
  selector: 'app-divider-label',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Button, Divider],
  template: `
    <div class="flex max-w-sm flex-col gap-4">
      <vig-button label="Continue with email" [fullWidth]="true" />
      <vig-divider label="or" />
      <vig-button label="Continue with SSO" variant="secondary" [fullWidth]="true" />
    </div>
    <div class="flex max-w-md flex-col gap-3">
      <vig-divider label="Today" align="start" />
      <vig-divider label="End of results" align="end" />
    </div>
  `,
})
export class DividerLabelDemo {}
```

## Vertical

`orientation="vertical"` separates inline items such as toolbar groups or footer links. It stretches to the height of its flex row.

```typescript title="divider-vertical.ts"
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Divider } from '@vigdx/ui/divider';
import { Link } from '@vigdx/ui/link';

@Component({
  selector: 'app-divider-vertical',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Divider, Link],
  template: `
    <nav aria-label="Footer" class="flex flex-wrap items-center gap-3 text-sm">
      <vig-link href="/privacy" variant="muted" underline="hover">Privacy</vig-link>
      <vig-divider orientation="vertical" />
      <vig-link href="/terms" variant="muted" underline="hover">Terms</vig-link>
      <vig-divider orientation="vertical" />
      <vig-link href="/status" variant="muted" underline="hover">Status</vig-link>
    </nav>
  `,
})
export class DividerVerticalDemo {}
```

## Styling hooks

Internal elements carry a stable `data-part` and the component's `data-scope`; both are public API, so removing one is a breaking change. Select a part by both, e.g. `[data-scope="divider"][data-part="line"] { … }`: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through `aria-*` and, where listed, a `data-state`; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other `data-*` attributes listed below (such as `data-opening` while an overlay animates) are API too. See [Customizing](https://vigdx.com/docs/theming.md#customizing).

Scope: `[data-scope="divider"]`

| Part | Element | data-state |
| --- | --- | --- |
| `line` | A rule segment. |   |
| `label` | The label text. |   |

## Accessibility

- The host is `role="separator"` with `aria-orientation`, so screen readers can announce the boundary between groups.
- A `label` also becomes the separator's accessible name.
- The separator is static and never focusable. For purely visual lines that separate nothing meaningful, use a CSS border instead so the boundary is not announced.

## API

### Divider

Selector: `vig-divider` · Kind: component

Thin rule separating content, optionally carrying a label. The label is placed at the inline start, centre or end, with the rule filling the rest.

#### Inputs

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `align` | `DividerAlign` | `'center'` | — |
| `label` | `string \| undefined` | `undefined` | Optional text shown within the rule, e.g. "or". |
| `orientation` | `DividerOrientation` | `'horizontal'` | — |
