# Status

`Status` shows a state as a 6px dot and a label, as [Geist's Status Dot](https://vercel.com/geist/status-dot). The dot takes the color of the tone. The label keeps the color of the text around it, so color is never the only signal.

_Interactive preview available on the rendered documentation page._


## Installation

Install `@vite-hub/ui` as described in [Installation](https://vitehub.dev/docs/ui/installation). The Nuxt module auto-imports `Status`. In Vue with Vite, import it from `vite-hub/ui`:

```ts
import { Status } from "vite-hub/ui";
```

## Usage

```vue
<template>
  <Status tone="success" label="Ready" />
  <Status tone="info" label="Building" pulse />
  <Status tone="error" label="Failed" colored />
</template>
```

## Tones

| Tone      | Use it for                                    |
| --------- | --------------------------------------------- |
| `neutral` | Not started, a draft, or cancelled.           |
| `success` | Done, connected, or published.                |
| `warning` | Queued, partial, or waiting for someone.      |
| `error`   | Failed, or a problem that needs action.       |
| `info`    | Running, or a state that is only information. |

## Colored label

Add `colored` when the label is the status itself, such as "Failed" or "Expired". The label then uses the darker text shade of the tone, which keeps 4.5:1 on the page. Leave it off when the label names something else, such as a legend entry beside a chart.

## Live states

Add `pulse` while the state can change soon, such as "Connecting" or "Running". The dot pings. The ping stops when the reader prefers reduced motion.

## Accessibility

The dot is decorative. The label is the accessible text. When a layout shows only the dot, leave out the label and put the text beside the dot in a visually hidden element, so screen readers still hear it:

```vue
<template>
  <Status tone="success" />
  <span class="sr-only">Published</span>
</template>
```

`Status` does not announce changes. Wrap a status that changes while the reader is on the page in an element with `role="status"`.

## API Reference

### Status

Renders a `span` with `data-slot="status"`, `data-tone`, and `data-size`. The dot is a `span` with `data-slot="status-indicator"`, and the label a `span` with `data-slot="status-label"`. The default slot replaces the label.

#### Props

| Prop      | Type                                                      | Default     | Description                                                   |
| --------- | --------------------------------------------------------- | ----------- | ------------------------------------------------------------- |
| `tone`    | `"neutral" \| "success" \| "warning" \| "error" \| "info"` | `"neutral"` | The color of the dot.                                         |
| `label`   | `string`                                                  |             | The text beside the dot.                                      |
| `colored` | `boolean`                                                 | `false`     | Colors the label with the tone. Use it when the label is the status. |
| `pulse`   | `boolean`                                                 | `false`     | Pings the dot for a live or pending state.                    |
| `size`    | `"sm" \| "md"`                                            | `"sm"`      | `sm` for 12px text, `md` for 14px text.                       |

## Related

- [Connection Status](https://vitehub.dev/docs/ui/connection-status) shows the connection of a realtime editor.
- [Sync Status](https://vitehub.dev/docs/ui/sync-status) shows whether edits are saved.

<!-- vitehub-docs:section-links -->
## In this section

- [Start](https://vitehub.dev/raw/docs/ui.md)
- [AI components](https://vitehub.dev/raw/docs/ui/ai-components.md)
- [Blocks](https://vitehub.dev/raw/docs/ui/blocks/chat-app.md)
- Parts
  - [Message](https://vitehub.dev/raw/docs/ui/message.md)
  - [Bubble](https://vitehub.dev/raw/docs/ui/bubble.md)
  - [Marker](https://vitehub.dev/raw/docs/ui/marker.md)
  - [Attachment](https://vitehub.dev/raw/docs/ui/attachment.md)
  - [Trace](https://vitehub.dev/raw/docs/ui/trace.md)
  - [Code Block](https://vitehub.dev/raw/docs/ui/code-block.md)
  - [Copy Button](https://vitehub.dev/raw/docs/ui/copy-button.md)
  - [Status](https://vitehub.dev/raw/docs/ui/status.md) (this page)
  - [Relative Time](https://vitehub.dev/raw/docs/ui/relative-time.md)
- [Chat](https://vitehub.dev/raw/docs/ui/chat.md)
- [Collaboration](https://vitehub.dev/raw/docs/ui/avatar-stack.md)
- [Agent work](https://vitehub.dev/raw/docs/ui/tool-list.md)
- [Utilities](https://vitehub.dev/raw/docs/ui/attachments.md)

Next: [Relative Time](https://vitehub.dev/raw/docs/ui/relative-time.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
