# Spinner

> A turning ring with a label, for a wait of unknown length.

```tsx
import { Spinner } from '@brand-studio/ui';

export default function SpinnerDemo() {
  return (
    <div style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 32 }}>
      <Spinner label="Checking stock" />
      <Spinner size={32} label="Loading orders" hideLabel />
    </div>
  );
}
```

## Installation

```sh
npm install @brand-studio/ui
```

React 18 or 19 is a peer dependency. Import the stylesheet once and wrap the app in a brand theme:

```tsx
import '@brand-studio/ui/styles.css';
import { BrandTheme, Spinner } from '@brand-studio/ui';
import brand from './brand.json';

<BrandTheme palette={brand.tokens} mode="system">
  {/* your app */}
</BrandTheme>
```

## Usage

```tsx
import { Spinner } from '@brand-studio/ui';
```

```tsx
<Spinner label="Checking stock" />
```

## Accessibility

- The label sits in a `role="status"` region. `hideLabel` keeps it for screen readers only.
- Under reduced motion the ring stops turning and the label carries the meaning.
- Use Skeleton when you know the shape of what is loading, and Button's `loading` prop for a pressed button.

## API Reference

| Prop | Type | Default |
|---|---|---|
| `label?` | `string` | `'Loading'` |
| `hideLabel?` | `boolean` | `false` |
| `size?` | `number` | `20` |
| `className?` | `string` | `''` |

Source: https://brandstudio.js.org/docs/components/spinner/
