Skip to main content

Spinner

BasicFeedback<co-spinner>

Spinner shows that something is loading when the wait is short or its length is unknown.

import { Spinner } from 'health-components';

Examples​

Overview​

Storybook

Usage​

<Spinner label="Checking coverage" /> <Spinner size="lg" tone="ai" />

When to use​

  • Inside buttons (Button loading) and for waits under a few seconds.

When not to use​

  • Known layouts that load: Skeleton. Long jobs: ProgressBar.

Variants and states​

VariantWhat it is
sm14px.
lg36px.
aiAI purple top, for AI work.

Accessibility​

  • role status with a label; slows under prefers-reduced-motion.

Do and don't​

  • Do: "Checking coverage with Aetna" next to it.
  • Don't: A spinner with no text for more than 2 seconds.

Props​

PropTypeDefaultDescription
size'sm' | 'lg''sm''sm' | 'lg'
tone'primary' | 'ai''primary''primary' | 'ai'
labelstring"Loading"Accessible name announced by screen readers

Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.

Angular, Vue and HTML​

Register the elements once (Angular guide), then use <co-spinner>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.

Angular template
<co-spinner size="…" tone="…" [defaultValue]="defaultValue"></co-spinner>
KindNameDescription
attributesize'sm' | 'lg'; default 'sm'
attributetone'primary' | 'ai'; default 'primary'
attributelabelAccessible name announced by screen readers; default "Loading"
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus