Components / Feedback and display
LoadingDots
Three dots that pulse in sequence, or a turning spinner, for short waits of unknown length. For a task with known progress, show the progress itself.
When to useLink to "When to use"
- Inside a button while it saves (Button does this for you with
loading). - Inline status text, list footers, a panel that is still loading.
UsageLink to "Usage"
import { LoadingDots } from "@arshad-shah/cynosure";
<LoadingDots label="Saving document" /> // announced
<LoadingDots size="lg" tone="accent" /> // decorative
<LoadingDots color="#14b8a6" speed="slow" /> // one-off colourAnnouncing itLink to "Announcing it"
By default the dots are decorative. Set label to give them role="status" and an accessible name. Leave it out when the surrounding control already reports the state, as Button does with aria-busy.
Size, tone and speedLink to "Size, tone and speed"
size defaults to inherit, which follows the surrounding font size; sm, md and lg are fixed. tone is any tone, muted, or inherit (the current text colour). speed is slow, normal or fast. color takes any CSS colour for one-off cases; prefer tones.
SpinnerLink to "Spinner"
variant="spinner" draws the loader icon turning instead of the dots. It is one em square, so it sits where an icon would: a statement gutter, a tree row, a tool call's header, beside a button's text. It takes the same size, tone, color, speed and label.
<Button>
<LoadingDots variant="spinner" /> Connecting
</Button>PropsLink to "Props"
| Prop | What it does | Type | Default |
|---|---|---|---|
variant | dots (default): three dots that pulse in sequence. spinner: the loader icon turning, icon-sized, for tight places such as a gutter, a tree row or beside a button's text. | "dots" | "spinner" | |
size | inherit follows the surrounding font size (use inside text and buttons); otherwise a fixed size. | "sm" | "md" | "lg" | "inherit" | |
tone | Semantic colour. inherit uses the current text colour. | Tone | "inherit" | "muted" | |
color | Any CSS colour; overrides tone for one-off cases. Prefer tones or tokens. | string | |
speed | Pulse or turn speed. Reduced motion always shows still dots or a still spinner. | "slow" | "normal" | "fast" | |
label | Announces progress (role="status") with this name. Omit when the surrounding control already reports it (e.g. Button aria-busy). | string | |
className | Added to the root element, for layout. | string | |
style | Layout only. Restyle through --cy-loading-dots-* tokens. | CSSProperties | |
data-testid | Set on the root element, for tests. | string |
Generated from the type definitions in @arshad-shah/cynosure 0.5.0.
Behaviour and accessibilityLink to "Behaviour and accessibility"
- Reduced motion: with the OS setting or
createTheme({ motion: "reduced" }), the dots stay still and fully visible, and the spinner stops turning. - Without a label the dots or spinner are
aria-hidden. The spinner's icon is always decorative; with a label the root is the status.
ThemingLink to "Theming"
Tokens: --cy-loading-dots-dot-size, --cy-loading-dots-gap, --cy-loading-dots-color, --cy-loading-dots-duration and --cy-loading-dots-size-{sm,md,lg}.
createTheme({ components: { loadingDots: { gap: "0.4em" } } });RelatedLink to "Related"
These examples run Cynosure 0.5.0 (commit 50ce30b), the version on npm.