Animated indicators for general loading and AI work, like reading a file or reasoning.
import {Loader} from "@heroui-pro/react";
<Loader variant="sparkle">
<Loader.Indicator />
<Loader.Label>Thinking</Loader.Label> {/* Optional */}
</Loader>;Pass label to show text next to the indicator. Screen readers read the label instead of "Loading".
size is sm (16px), md (20px), or lg (24px). The infinity variant is 1.5 times as wide. To match a HeroUI Spinner, use sm for sm (16px) and lg for md (24px).
color takes the same values as Spinner: accent (default), current, success, warning, or danger. current inherits the text color.
<Loader color="success" label="Saved" variant="pulse" />Use Loader.Indicator and Loader.Label to put custom content, such as TextShimmer, in the label.
HeroUI follows the BEM methodology to ensure component variants and states are reusable and easy to customize.
The Loader component uses these CSS classes:
.loader: Root element.loader__indicator: Animated indicator.loader__label: Visible label.loader__fallback: Visually hidden status text, rendered when there is no label.loader--sm / .loader--lg: Size modifiers (md is the default).loader__indicator--{variant}: Variant modifier, for example --ring.loader--accent / .loader--current / .loader--success / .loader--warning / .loader--danger: Color modifiersThe indicator follows color. A text color utility on the root, such as text-muted, wins over it. The label stays muted.
The internal drawing classes inside Loader.Indicator (such as .loader__track and .loader__{variant}-*) are intentionally omitted; pass children to Loader.Indicator to replace the drawing.
[data-variant] on .loader: Indicator variant[data-size] on .loader: Indicator size--loader-size: Indicator size, set on the root from size--loader-radius: Rounds the corners of scan, grid, and shuffle; set on the root and follows the theme --radiusThe root has role="status", so screen readers announce changes without interrupting.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "ring" | "classic" | "dots" | "pulse" | "scan" | "grid" | "shuffle" | "wave" | "sparkle" | "atom" | "morph" | "helix" | "twist" | "infinity" | "ring" | Indicator style |
size | "sm" | "md" | "lg" | "md" | Indicator size: 16, 20 or 24px |
color | "accent" | "current" | "success" | "warning" | "danger" | "accent" | Indicator color, as on Spinner |
label | string | - | Visible text rendered in Loader.Label. Ignored when children is set |
aria-label | string | "Loading" | Hidden status text when there is no label. With a label, names the root |
children | ReactNode | - | Custom composition of Loader.Indicator and Loader.Label |
className | string | - | Additional classes, including text color utilities |
Also supports render props from HeroUI dom.span.
Animated indicator for the root's variant, hidden from screen readers. Under prefers-reduced-motion: reduce, it stops on a still frame. Supports native svg props.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | SVG content that replaces the drawing. Set viewBox to match |
Visible status text. It replaces the hidden "Loading" text anywhere inside the root. In server markup, only a label placed directly inside the root or in a fragment replaces it; a label inside another component replaces it once mounted. Supports native span props.
label. Screen readers may miss a loader that mounts together with its text.aria-hidden when a parent already announces the status, such as a pending button.Resources