Loading
Indeterminate progress for a pending operation. Configure size, semantic colour and animation; a text message remains available to assistive technology in every mode.
Usage
import { Loading } from '@flabbergasted-ai/react';
<Loading label="Refreshing projects…" />Copy the component into your project with the CLI:
pnpm dlx @flabbergasted-ai/cli add loadingSizes
<Loading size="sm" label="Small" /><Loading size="md" label="Medium" /><Loading size="lg" label="Large" /><Loading size={28} label="28 pixels" />Colours
<Loading color="primary" label="Primary" /><Loading color="secondary" label="Secondary" /><span className="text-info-fg"> <Loading color="inherit" label="Inherited" /></span>Colours use semantic tokens. Reserve accent for progress on the primary workflow, such as creating a workspace. The label stays readable independently of the indicator colour. Use inherit with a semantic text class to match another foreground.
Animations
<Loading animation="spin" label="Refreshing…" /><Loading animation="pulse" label="Connecting…" /><Loading animation="dots" label="Processing…" />Compact indicator
<Loading size="sm" label="Refreshing projects…" showLabel={false} />Hide the message only when nearby text already explains the pending operation. The label remains in the status region for screen readers.
Behaviour and accessibility
Render Loading only while an operation is pending, then replace it with the result or an error and recovery action. Preserve existing content during background refresh. Use Skeleton when a placeholder can match the final layout, and Button loading for an action inside a button. Loading announces its message politely without taking focus; avoid nesting it in another live region. All three animations stop under prefers-reduced-motion, leaving a static indicator and the loading message.
Props
| Prop | Type | Default | Notes |
|---|---|---|---|
size | 'sm' | 'md' | 'lg' | number | 'md' | Indicator size: 1rem, 1.25rem or 2rem. A positive number sets pixels. |
color | 'primary' | 'secondary' | 'accent' | 'inherit' | 'secondary' | Indicator foreground. Inherit follows the root text colour. |
animation | 'spin' | 'pulse' | 'dots' | 'spin' | Rotating ring, staggered pulsing signal bars or bouncing dots. |
label | string | 'Loading…' | Describe the pending operation. Also used in icon-only mode. |
showLabel | boolean | true | False visually hides the text while retaining it for screen readers. |
className / ref / … | span props | — | Applied to the root span. Children are reserved for the indicator and label. |