# Spinner

A small indeterminate loading indicator.

- Family: feedback
- Import: `import { Spinner } from "@senvenli/react/feedback";`
- Page: https://design.senvenli.com/docs/components/spinner
- JSON: https://design.senvenli.com/docs/components/spinner.json

## Example: Sizes

Small inline, medium beside a label, large for a region. `aria-label` says what is happening.

```tsx
import { Spinner } from "@senvenli/react/feedback";
import { Stack } from "@senvenli/react/layout";

export default function Example() {
  return (
    <Stack direction="horizontal" space="space-300">
      <Spinner size="small" aria-label="Saving draft" />
      <Spinner aria-label="Checking the address" />
      <Spinner size="large" aria-label="Loading orders" />
    </Stack>
  );
}
```

## Examples

### Beside visible text

The text already says it, so the spinner is decorative.

```tsx
import { Text } from "@senvenli/react/display";
import { Spinner } from "@senvenli/react/feedback";
import { Stack } from "@senvenli/react/layout";

export default function Example() {
  return (
    <Stack direction="horizontal" space="space-100">
      <Spinner size="small" isDecorative />
      <Text size="body-small" tone="subtle">Checking the invoice number…</Text>
    </Stack>
  );
}
```

## Guidelines

### When to use it

- Something short is loading in place.

### Use something else when

- [skeleton](https://design.senvenli.com/docs/components/skeleton.md): A whole layout is loading.

## Accessibility

Built in:

- Named "Loading…" unless decorative or labelled.

You provide:

- `isDecorative` when visible text already says what is loading.

## API reference

### Spinner

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| size | `SpinnerSize` | `"medium"` | no |  |
| aria-label | `string` |  | no | What is happening ("Checking availability"). Omit when visible text next to it says it, and pass `isDecorative`; otherwise "Loading…". |
| isDecorative | `boolean` |  | no | Visible text already says it (a pending button): hidden from assistive tech. |

### Tokens it reads

`--ds-icon-brand`, `--ds-icon-subtle`, `--ds-radius-full`

## Related

- [skeleton](https://design.senvenli.com/docs/components/skeleton.md)
- [progress](https://design.senvenli.com/docs/components/progress.md)
