# StatusChip

Names the status of a payment, an authorization, or a network.

[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/StatusChip.tsx)

Figma: [Elements/Network Chip](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-3090), [Messaging/Status Chip](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-3776)

## Overview

A status chip renders a short label in a tinted pill, led by a dot in the color of its `intent`. A loading chip replaces the dot with a spinner, for a status that is still in progress. A network chip names a network at a fixed minimum width.

## Examples

### Basic

```tsx
import { StatusChip } from '@tempoxyz/ds'

export function Demo() {
  return <StatusChip intent="warning">Pending</StatusChip>
}
```

[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/StatusChip/Basic.tsx)

### Intent

Set `intent` to `neutral` (default), `positive`, `warning`, or `negative`.

```tsx
import { StatusChip, style } from '@tempoxyz/ds'

export function Demo() {
  return (
    <div {...styles.row()}>
      <StatusChip intent="positive">Authorized</StatusChip>
      <StatusChip intent="warning">Needs approval</StatusChip>
      <StatusChip intent="negative">Failed</StatusChip>
      <StatusChip intent="neutral">Expired</StatusChip>
    </div>
  )
}

namespace styles {
  export const row = style({ alignItems: 'center', display: 'flex', flexWrap: 'wrap', gap: '8' })
}
```

[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/StatusChip/Intent.tsx)

### Size

Set `size` to `medium` (28px, default) or `small` (24px).

```tsx
import { StatusChip, style } from '@tempoxyz/ds'

export function Demo() {
  return (
    <div {...styles.row()}>
      <StatusChip intent="positive">Live</StatusChip>
      <StatusChip intent="positive" size="small">
        Live
      </StatusChip>
    </div>
  )
}

namespace styles {
  export const row = style({ alignItems: 'center', display: 'flex', gap: '8' })
}
```

[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/StatusChip/Size.tsx)

### Loading

Set `loading` for a status in progress, such as Processing.

```tsx
import { StatusChip } from '@tempoxyz/ds'

export function Demo() {
  return <StatusChip loading>Processing</StatusChip>
}
```

[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/StatusChip/Loading.tsx)

### Network

Set `network` for a chip that names a network, such as Mainnet or Testnet. It keeps an 80px minimum width, with the dot closer to the label.

```tsx
import { StatusChip, style } from '@tempoxyz/ds'

export function Demo() {
  return (
    <div {...styles.row()}>
      <StatusChip intent="positive" network>
        Mainnet
      </StatusChip>
      <StatusChip intent="warning" network>
        Testnet
      </StatusChip>
    </div>
  )
}

namespace styles {
  export const row = style({ alignItems: 'center', display: 'flex', gap: '8' })
}
```

[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/StatusChip/Network.tsx)

## Anatomy

Import the component and assemble its parts.

```tsx
import { StatusChip } from '@tempoxyz/ds'

<StatusChip />
```

## Guidelines

### When to Use

* Show where a payment, a deposit, or an authorization stands, such as Pending or Authorized.
* Show whether a network is live or a testnet, with `network`.

### When Not to Use

* Use [Badge](/docs/components/badge) for a category or an attribute that is not a status.
* Use [Alert](/docs/components/alert) to explain a status and what to do next.
* Use [AssetChip](/docs/components/asset-chip) for the assets a row supports.

### Pick the Intent From the Outcome

* **Positive:** The action is done, or the item is live.
* **Warning:** The item waits on a person or a later step.
* **Negative:** The action failed and needs attention.
* **Neutral:** The item ended without an outcome.

### Name Only Statuses

**Do:** Place the chip at the end of the row whose status it names.

```tsx
import { ListGroup, StatusChip } from '@tempoxyz/ds'

export function Demo() {
  return (
    <ListGroup variant="boxed">
      <ListGroup.Row>
        <ListGroup.Info>
          <ListGroup.Title>Claude</ListGroup.Title>
          <ListGroup.Description>$10.00 a month</ListGroup.Description>
        </ListGroup.Info>
        <StatusChip intent="positive" size="small">
          Authorized
        </StatusChip>
      </ListGroup.Row>
    </ListGroup>
  )
}
```

**Don't:** Use a status chip for a category. Use a [Badge](/docs/components/badge).

```tsx
import { ListGroup, StatusChip } from '@tempoxyz/ds'

export function Demo() {
  return (
    <ListGroup variant="boxed">
      <ListGroup.Row>
        <ListGroup.Info>
          <ListGroup.Title>Claude</ListGroup.Title>
          <ListGroup.Description>$10.00 a month</ListGroup.Description>
        </ListGroup.Info>
        <StatusChip intent="positive" size="small">
          Agent
        </StatusChip>
      </ListGroup.Row>
    </ListGroup>
  )
}
```

## Content

### Write the Status

Write one or two words that name the state, such as Pending, Live, or Needs approval. Use sentence case, and leave out words such as Status.

## Accessibility

A status chip renders a `<span>` that screen readers read as text in place. The dot and the spinner are hidden, so the label alone carries the status.

### Semantics

* **Root (span):** Screen readers read the label in place, without the dot.
* **Loading (aria-hidden):** The spinner is hidden, so screen readers read the label once.

### Your Responsibilities

* **Name the Status in Text (SC 1.4.1):** The intent color is decorative, so the label must name the status.
* **Announce a Change (aria-live):** Wrap a chip that changes in place in a polite live region.

## Related

[Badge](/docs/components/badge)

Use for categories and attributes.

[Alert](/docs/components/alert)

Use for a status that needs an explanation.

[StatusRow](/docs/components/status-row)

Use for a status that follows a payment in a row.
