# Status Dot

> A decorative dot that marks a status beside its visible text.

```tsx title="hero.tsx"
import { StatusDot } from '@langgenius/dify-ui/status-dot'

export function StatusDotHeroDemo() {
  return (
    <span className="inline-flex items-center gap-1.5 system-sm-medium text-text-secondary">
      <StatusDot status="success" />
      Published
    </span>
  )
}
```

## Usage guidelines

- **Pair the dot with visible text**: `StatusDot` is always hidden from assistive technology and accepts no ARIA props or role. The text next to it carries the status for every user.
- **Map the status, not the color**: `success`, `warning`, `error`, `normal` and `disabled` set the fill, border and glow together for both themes. Do not recolor the dot with classes.
- **Keep announcements with the feature**: A status that changes while the user watches is announced by the feature's live region or status owner, not by the dot.
- **Show a skeleton while the status loads**: `StatusDotSkeleton` takes the same size and stays decorative. Keep a text label such as "Checking" beside it; any pulse comes from the caller.

## Anatomy

```tsx
import { StatusDot, StatusDotSkeleton } from '@langgenius/dify-ui/status-dot'
```

```tsx
<StatusDot />
<StatusDotSkeleton />
```

## Examples

### Statuses

Five statuses cover run results and availability. Each row keeps its label next to the dot.

```tsx title="statuses.tsx"
import type { StatusDotStatus } from '@langgenius/dify-ui/status-dot'
import { StatusDot } from '@langgenius/dify-ui/status-dot'

const nodes: { name: string; status: StatusDotStatus; label: string }[] = [
  { name: 'Knowledge retrieval', status: 'success', label: 'Succeeded' },
  { name: 'HTTP request', status: 'warning', label: 'Retried twice' },
  { name: 'Code', status: 'error', label: 'Failed' },
  { name: 'LLM', status: 'normal', label: 'Running' },
  { name: 'Template', status: 'disabled', label: 'Skipped' },
]

export function StatusDotStatusesDemo() {
  return (
    <ul className="flex w-full max-w-72 flex-col gap-2">
      {nodes.map((node) => (
        <li key={node.name} className="flex items-center justify-between gap-4">
          <span className="min-w-0 truncate system-sm-regular text-text-secondary">
            {node.name}
          </span>
          <span className="flex shrink-0 items-center gap-1.5 system-xs-medium text-text-tertiary">
            <StatusDot status={node.status} />
            {node.label}
          </span>
        </li>
      ))}
    </ul>
  )
}
```

### Sizes

`small` (6px) suits extra-small text, and `medium` (8px, the default) suits regular labels.

```tsx title="sizes.tsx"
import { StatusDot } from '@langgenius/dify-ui/status-dot'

const sizes = [
  { size: 'small', pixels: '6px', textClassName: 'gap-1 system-2xs-medium' },
  { size: 'medium', pixels: '8px', textClassName: 'gap-1.5 system-xs-medium' },
] as const

export function StatusDotSizesDemo() {
  return (
    <div className="flex flex-wrap items-end gap-8">
      {sizes.map(({ size, pixels, textClassName }) => (
        <div key={size} className="flex flex-col items-center gap-2">
          <span className={`flex items-center text-text-secondary ${textClassName}`}>
            <StatusDot status="normal" size={size} />
            Syncing
          </span>
          <span className="system-xs-regular text-text-tertiary tabular-nums">
            {size} · {pixels}
          </span>
        </div>
      ))}
    </div>
  )
}
```

### Skeleton

`StatusDotSkeleton` holds the place of a dot while the status loads, and the label says so. The pulse is a caller class that stops when the user prefers reduced motion.

```tsx title="skeleton.tsx"
import { StatusDot, StatusDotSkeleton } from '@langgenius/dify-ui/status-dot'

export function StatusDotSkeletonDemo() {
  return (
    <ul className="flex w-full max-w-72 flex-col gap-2">
      <li className="flex items-center justify-between gap-4">
        <span className="min-w-0 truncate system-sm-regular text-text-secondary">Web app</span>
        <span className="flex shrink-0 items-center gap-1.5 system-xs-medium text-text-secondary">
          <StatusDot status="success" />
          In service
        </span>
      </li>
      <li className="flex items-center justify-between gap-4">
        <span className="min-w-0 truncate system-sm-regular text-text-secondary">
          Backend service API
        </span>
        <span className="flex shrink-0 items-center gap-1.5 system-xs-medium text-text-tertiary">
          <StatusDotSkeleton className="animate-pulse motion-reduce:animate-none" />
          Checking
        </span>
      </li>
    </ul>
  )
}
```

## API reference

### StatusDot

A decorative status dot hidden from assistive technology. Renders a `<span>` element.

Always pair with visible status text owned by the surrounding component.

**Props**

| Prop        | Type                                                          | Default     | Description                            |
| ----------- | ------------------------------------------------------------- | ----------- | -------------------------------------- |
| `role?`     | `undefined`                                                   | —           | —                                      |
| `tabIndex?` | `undefined`                                                   | —           | —                                      |
| `status?`   | `'disabled' \| 'error' \| 'normal' \| 'success' \| 'warning'` | `'success'` | The status the dot's color represents. |
| `size?`     | `'medium' \| 'small'`                                         | `'medium'`  | The size of the dot.                   |

### StatusDotSkeleton

**Props**

| Prop        | Type                  | Default    | Description          |
| ----------- | --------------------- | ---------- | -------------------- |
| `role?`     | `undefined`           | —          | —                    |
| `tabIndex?` | `undefined`           | —          | —                    |
| `size?`     | `'medium' \| 'small'` | `'medium'` | The size of the dot. |
