Tinyrack

Spinner

Announced indeterminate progress with size and semantic color axes.

Contract

AxisValuesDefault
uiSizemd, lgmd
variantcurrent, muted, primary, dangercurrent
labelaccessible status textLoading
decorativetrue, falsefalse

Install

pnpm add @tinyrack/ui

Scroll inside the code area to read long lines.

Styles

@import '@tinyrack/ui/components/spinner.css';

Scroll inside the code area to read long lines.

Imports

import { TRSpinner } from '@tinyrack/ui/components/spinner';

Scroll inside the code area to read long lines.

Playground

Usage

Examples

Sizes permalink

Match the spinner size to nearby text or controls.

Color variants permalink

Use current to inherit surrounding text, muted for low emphasis, primary for active work, and danger for a failing task.

Standalone status or control decoration permalink

A standalone TRSpinner owns the status. A named TRButton owns its loading state and hides the nested spinner. Rotation stops under reduced motion.

Task lifecycle permalink

Start, finish, and reset the task to verify that the announced status only exists while work is running.

API

By default TRSpinner exposes role="status"; use a non-empty, task-specific label. Blank labels fall back to Loading. Set decorative inside an already named loading control or status region so only one element is announced. Mount the spinner only while work is pending, put aria-busy="true" on the region being updated when appropriate, and announce completion from that region. Rotation stops when the user requests reduced motion.

CSS tokenDefaultPurpose
--tr-spinner-sizesize recipeIndicator diameter
--tr-spinner-stroke-width--tinyrack-spinner-stroke-widthRing thickness
--tr-spinner-colorsemantic variant colorActive and track color
--tinyrack-spinner-size-mdfoundation metricSmall diameter
--tinyrack-spinner-size-mdfoundation metricMedium diameter
--tinyrack-spinner-size-lgfoundation metricLarge diameter
--tinyrack-spinner-track-opacityfoundation metricInactive ring opacity