Feedback

Spinner

Inline loading indicator that wraps a spinning lucide icon and inherits the surrounding text color.

Preview
01 Installation

Install

Pull Spinner from the barrel for everyday use, or the granular path when you want a tighter bundle.

tsxBarrel1 line
import { Spinner } from "@brika/clay";
tsxGranular1 line
import { Spinner } from "@brika/clay/components/spinner";
02 Usage

A minimal example

Drop this into a page. Native HTML attributes pass through to the underlying primitive.

tsxSpinner.tsx6 lines
import { Spinner } from '@brika/clay/components/spinner';

/** Bare spinner, decorative by default and marked `aria-hidden`. */
export default function SpinnerDefaultDemo() {
  return <Spinner />;
}
03 Examples

Spinner, every way

In Button

Compose the spinner inside a disabled button to communicate an in-flight action.

Sizes

All three sizes side by side, `sm` (0.875rem), `default` (1rem), and `lg` (1.25rem).

With Label

Pass `label` to wrap the spinner in a `role="status"` element with an sr-only string for screen readers.

04 Accessibility

Accessibility

  • Decorative spinners must set aria-hidden="true" so screen readers skip them, Clay applies this automatically when no label is provided.
  • Spinners that convey loading state should pass a label, the wrapper renders role="status" with a visually hidden (sr-only) label so AT users hear the state.
  • When pairing a visible loading text next to the spinner, keep the spinner aria-hidden and let the visible text carry the announcement.
05 Tokens 2 theme-overridable

Theme tokens

Every CSS variable Spinner reads, with its default and the dotted path you'd write in a ThemeConfig JSON to override it. Set any of these in your theme to retune Spinner without touching component code.

Spinner tokens

2 tokens
ColorFill, border, and text colors.1
  • --spinner-colorcolorcurrentColor
    components.spinner.color

    Spinner stroke color, defaults to `currentColor` so it inherits text color.

GeometrySizes, lengths, and corner radii.1
  • --spinner-sizesize1rem
    components.spinner.size

    Default spinner dimension (width and height) for the `default` size variant.

Override in a theme

Authoring a theme is plain JSON. Drop overrides under components.spinner, the names are camelCase versions of the variable suffix.

jsonmy-theme.json12 lines
{
  "id": "my-theme",
  "name": "My Theme",
  "description": "...",
  "accentSwatches": ["#000"],

  "components": {
    "spinner": {
      "color": "currentColor"
    }
  }
}

Then apply with applyTheme(myTheme) (see the theming guide), scope it to a subtree with themeToCssVars(myTheme, mode), or consume any token directly in your own JSX with the matching Tailwind utility (e.g. bg-spinner-…) — see the chips on each token row.

06 API reference

API reference

Props specific to Spinner. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.

  • string
    Extra class names merged onto the rendered SVG. Use this to override defaults or compose layout utilities, Clay merges with tailwind-merge so the caller's classes win on conflict.
  • string
    Optional accessible label announcing the loading state. When provided, the spinner is wrapped in an <output> element with an sr-only label so assistive tech announces it. When omitted, the spinner is treated as decorative and marked aria-hidden.
  • sizedefault 'default'
    SpinnerSize
    Visual size of the spinner. Maps to Tailwind size-* utilities (sm → 0.875rem, default--spinner-size (1rem), lg → 1.25rem). Defaults to 'default'.