Animated loading indicator with an optional visible label: 14 drawings, 3 sizes, and the Spinner colors.
Animated loading indicator with an optional visible label: 14 drawings, 3 sizes, and the Spinner colors.
import { Loader } from 'heroui-native-pro';<Loader>
<Loader.Indicator />
<Loader.Label>...</Loader.Label>
</Loader>label, a visible label. Pass children to compose the parts yourself. Screen readers announce it as one busy progress indicator.variant, hidden from screen readers. Pass children to replace it with your own content.<Loader /><Loader variant="ring" />
<Loader variant="dots" />
<Loader variant="pulse" />
<Loader variant="grid" />
<Loader variant="wave" />
<Loader variant="classic" />
<Loader variant="scan" />
<Loader variant="shuffle" />
<Loader variant="sparkle" />
<Loader variant="infinity" />
<Loader variant="atom" />
<Loader variant="morph" />
<Loader variant="helix" />
<Loader variant="twist" />infinity is 1.5× as wide as it is tall.
<Loader size="sm" />
<Loader size="md" />
<Loader size="lg" />size also takes the indicator height in pixels. The drawing scales with it. A className cannot resize the drawing.
<Loader size={32} variant="grid" />
<Reasoning.Loader size={14} />Grid cells, shuffle tiles, and the scan frame round their corners from the theme --radius, scaled to the size.
<Loader color="accent" />
<Loader color="success" />
<Loader color="warning" />
<Loader color="danger" />
<Loader color="current" />current resolves to the theme foreground color. Pass color to Loader.Indicator for any other color.
label is visible text after the indicator. It also names the loader for screen readers.
<Loader label="Generating response" />Pass accessibilityLabel when you compose the parts, since label is ignored with children.
<Loader variant="grid" accessibilityLabel="Searching the web">
<Loader.Label>Searching</Loader.Label>
<Loader.Indicator />
</Loader>Children of Loader.Indicator replace the drawing and render inside the indicator box.
<Loader>
<Loader.Indicator>
<MyIcon size={20} />
</Loader.Indicator>
</Loader>With the animation disabled, every drawing shows a static frame. The system "Reduce Motion" setting does the same.
<Loader variant="helix" animation={false} />import type { LoaderVariant } from 'heroui-native-pro';
import { Loader } from 'heroui-native-pro';
import { View } from 'react-native';
const ROWS: { label: string; variant: LoaderVariant }[] = [
{ label: 'Fetching results', variant: 'classic' },
{ label: 'Reading report.pdf', variant: 'scan' },
{ label: 'Running 3 of 5 steps', variant: 'grid' },
{ label: 'Listening', variant: 'wave' },
{ label: 'Brainstorming ideas', variant: 'sparkle' },
];
export default function LoaderExample() {
return (
<View className="flex-1 px-5 items-center justify-center gap-8">
<View className="gap-3">
{ROWS.map(({ label, variant }) => (
<Loader key={variant} label={label} size="sm" variant={variant} />
))}
</View>
<Loader variant="helix" accessibilityLabel="Reasoning">
<Loader.Indicator className="opacity-80" />
<Loader.Label className="text-foreground font-medium">
Reasoning
</Loader.Label>
</Loader>
</View>
);
}| prop | type | default | description |
|---|---|---|---|
children | ReactNode | - | Custom composition of Loader.Indicator and Loader.Label |
size | 'sm' | 'md' | 'lg' | number | 'md' | Indicator height: 16, 20, or 24px, or a number of pixels |
variant | LoaderVariant | 'ring' | Animation style |
color | 'accent' | 'current' | 'danger' | 'success' | 'warning' | 'accent' | Indicator color. current resolves to the theme foreground color |
label | string | - | Visible text after the indicator. Ignored when children is set |
accessibilityLabel | string | - | Accessible name. Defaults to label, then "Loading". Set it to localize |
className | string | - | Additional CSS classes for the root row |
animation | LoaderRootAnimation | - | Animation configuration |
...ViewProps | ViewProps | - | All standard React Native View props are supported |
'atom' | 'classic' | 'dots' | 'grid' | 'helix' | 'infinity' | 'morph' | 'pulse' | 'ring' | 'scan' | 'shuffle' | 'sparkle' | 'twist' | 'wave'
Animation configuration for the loader root. Can be:
false or "disabled": Show the static pose"disable-all": Show the static pose and disable animations in descendantstrue or undefined: Animate| prop | type | default | description |
|---|---|---|---|
children | ReactNode | - | Content that replaces the built-in drawing |
color | string | - | Color of the drawing. Overrides the root color |
className | string | - | Additional CSS classes for the indicator box |
...ViewProps | ViewProps | - | All standard React Native View props |
| prop | type | default | description |
|---|---|---|---|
children | ReactNode | - | Visible status text |
className | string | - | Additional CSS classes for the label |
...TextProps | TextProps | - | All standard React Native Text props |