# Divider

## Usage

`Divider` separates groups of content with a thin rule. It can carry a centered label.

```vue
<script setup lang="ts">
import { Divider } from '@astryx-vue/core/Divider'
</script>

<template>
  <Divider label="or" />
</template>
```

### Anatomy

- **Divider group**: Separator group that arranges one or two rules around an optional label.
- **Rule**: Painted line segment; a second segment renders when a label is present.
- **Label**: Optional content displayed between two rule segments.

## Best practices

| Guidance | Practices |
| --- | --- |
| Do | Use subtle dividers between related content sections and strong dividers for high-contrast boundaries. |
| Do | Add a label to the divider when sections need a visible category heading. |
| Don't | Overuse dividers; rely on spacing and layout to separate content when possible. |

## Examples

### Full bleed

The rule runs past the card padding, from edge to edge, between the line items and the total.

```vue
<script setup lang="ts">
import { Card } from '@astryx-vue/core/Card'
import { Divider } from '@astryx-vue/core/Divider'
import { Section } from '@astryx-vue/core/Section'
import { HStack, VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
</script>

<template>
  <Section variant="transparent" width="100%">
    <Card :width="400">
      <VStack :gap="3">
        <Text type="label">
          Order Summary
        </Text>
        <HStack h-align="between">
          <Text type="body">
            3 items
          </Text>
          <Text type="body">
            $127.00
          </Text>
        </HStack>
        <Divider is-full-bleed />
        <HStack h-align="between">
          <Text type="body">
            Shipping
          </Text>
          <Text type="body">
            $7.99
          </Text>
        </HStack>
        <HStack h-align="between">
          <Text type="body">
            Tax
          </Text>
          <Text type="body">
            $10.16
          </Text>
        </HStack>
        <Divider is-full-bleed />
        <HStack h-align="between">
          <Text type="label">
            Total
          </Text>
          <Text type="label">
            $145.15
          </Text>
        </HStack>
      </VStack>
    </Card>
  </Section>
</template>
```

### Variants

A labeled rule for an alternative such as “or”, then a strong rule before the fine print.

```vue
<script setup lang="ts">
import { Card } from '@astryx-vue/core/Card'
import { Divider } from '@astryx-vue/core/Divider'
import { Section } from '@astryx-vue/core/Section'
import { VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
</script>

<template>
  <Section variant="transparent" width="100%">
    <Card :width="400">
      <VStack :gap="3">
        <VStack :gap="1">
          <Text type="label">
            Sign in with email
          </Text>
          <Text type="body">
            Enter your email and password to access your account.
          </Text>
        </VStack>
        <Divider label="or" />
        <VStack :gap="1">
          <Text type="label">
            Sign in with SSO
          </Text>
          <Text type="body">
            Use your company credentials to sign in automatically.
          </Text>
        </VStack>
        <Divider variant="strong" />
        <Text color="secondary" type="supporting">
          By signing in, you agree to our Terms of Service and Privacy Policy.
        </Text>
      </VStack>
    </Card>
  </Section>
</template>
```

### Vertical

Vertical rules between side-by-side metrics.

```vue
<script setup lang="ts">
import { Card } from '@astryx-vue/core/Card'
import { Divider } from '@astryx-vue/core/Divider'
import { Section } from '@astryx-vue/core/Section'
import { HStack, StackItem, VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'

const metrics = [
  { label: 'Revenue', value: '$24,500', delta: '+12% vs last month' },
  { label: 'Users', value: '1,240', delta: '+8% vs last month' },
  { label: 'Conversion', value: '3.2%', delta: '-0.5% vs last month' },
]
</script>

<template>
  <Section variant="transparent" width="100%">
    <Card>
      <HStack align="stretch" :gap="4">
        <template v-for="(metric, index) in metrics" :key="metric.label">
          <Divider v-if="index > 0" orientation="vertical" style="align-self: stretch; height: auto" />
          <StackItem size="fill">
            <VStack :gap="1">
              <Text type="label">
                {{ metric.label }}
              </Text>
              <Text type="label">
                {{ metric.value }}
              </Text>
              <Text color="secondary" type="supporting">
                {{ metric.delta }}
              </Text>
            </VStack>
          </StackItem>
        </template>
      </HStack>
    </Card>
  </Section>
</template>
```

## Divider Props

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Orientation of the divider. |
| `label` | `string \| number` | — | Text centered on the divider. Also used as the accessible name. Numeric zero stays visible; an empty string does not. |
| `variant` | `'subtle' \| 'strong'` | `'subtle'` | Line weight. strong uses the emphasized border color. |
| `isFullBleed` | `boolean` | `false` | Extend to the container edges with negative margins. |

## Slots

- `label`: rich content in the middle of the divider. Replaces the `label` prop text.

## Theme

```css
.my-divider {
  --astryx-divider-color-subtle: #00000014;
}
```

- `--astryx-divider-color-subtle`: color of the `subtle` line.
- `--astryx-divider-color-strong`: color of the `strong` line.
- `--astryx-divider-label-color`: label text color.
- `--astryx-border-width`: line thickness.
