# Status Dot

## Usage

Import the component from its dedicated entry. Structural styles are loaded automatically.

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

<template>
  <StatusDot label="Online" variant="success" />
</template>
```

### Anatomy

- **Dot**: Painted status dot that carries the selected semantic variant.
- **Status icon**: Optional caller-supplied icon rendered inside the dot.

## Best practices

| Guidance | Practice |
| --- | --- |
| Recommended | Always provide `label`; screen readers announce it via `aria-label`. |
| Recommended | Use the dot as a supporting signal alongside a visible text label. |
| Recommended | Use `isPulsing` for live, ongoing activity such as streaming or syncing. |
| Don't | Rely on color alone for critical status. Color is not perceivable by everyone. |
| Don't | Use many pulsing dots on the same screen; it creates visual noise. |

## Examples

### Pulsing

isPulsing makes the dot breathe, for a state that is still in progress.

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

<template>
  <div class="status-dot-preview__row">
    <StatusDot label="Live" variant="success" is-pulsing />
    <StatusDot label="Recording" variant="error" is-pulsing />
    <StatusDot label="Syncing" variant="info" is-pulsing />
  </div>
</template>
```

### Status indicators

A label beside the dot for online, away, offline, and unknown.

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

const statuses: { variant: StatusDotVariant, label: string }[] = [
  { variant: 'success', label: 'Online' },
  { variant: 'warning', label: 'Away' },
  { variant: 'error', label: 'Offline' },
  { variant: 'neutral', label: 'Unknown' },
]
</script>

<template>
  <VStack :gap="2">
    <HStack v-for="item in statuses" :key="item.variant" :gap="2" align="center">
      <StatusDot :variant="item.variant" :label="item.label" />
      <Text type="body">
        {{ item.label }}
      </Text>
    </HStack>
  </VStack>
</template>
```

### Variants

Neutral, info, success, warning, and error, side by side.

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

<template>
  <div class="status-dot-preview__row">
    <StatusDot label="Offline" />
    <StatusDot label="Online" variant="success" />
    <StatusDot label="Busy" variant="error" />
    <StatusDot label="Away" variant="warning" />
    <StatusDot label="Pending" variant="info" />
  </div>
</template>
```

## Props

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | `StatusDotVariant` | `'neutral'` | The semantic color variant of the status dot. Optional: `neutral`, `info`, `success`, `warning`, `error`. |
| `label` | `string` | - | Required accessible label. Announced by screen readers via `aria-label`. |
| `isPulsing` | `boolean` | `false` | Whether the dot pulses to indicate an active state. |
| `icon` | `Component` | - | Icon drawn inside the dot. Omit it to keep a color-only signal. The `icon` slot wins. The icon is hidden from assistive tech; the name stays `label`. |
| `tooltip` | `string` | - | Tooltip text shown on hover and on keyboard focus, for when the status needs a sentence to explain it. |

## Slots

| Name | Description |
| --- | --- |
| `icon` | Icon drawn centered inside the dot, in the variant ink. Use a different icon per status so the meaning survives without color. Hidden from screen readers, which read `label`. |

## Native attributes

The root element is a `<span>`.

The following are passed to the root element:

- HTML attributes.
- `aria-*` attributes.
- `data-*` attributes.
- `class`.
- `style`.
