Loading skeletons and typing placeholders for assistant responses.
Loading skeletons and typing placeholders for assistant responses. For more spinner styles, see Loader.
import { ChatLoader } from 'heroui-native-pro';<ChatLoader.Dots />
<ChatLoader.Pulse />
<ChatLoader.Spinner />
<ChatLoader.Skeleton>
<ChatLoader.SkeletonAvatar />
<ChatLoader.SkeletonBlock>
<ChatLoader.SkeletonLine />
</ChatLoader.SkeletonBlock>
</ChatLoader.Skeleton>ChatLoader is a namespace of independent loaders, not a root with parts. Pick the one that fits the surface.
Spinner with an accessible label.size, variant, and animation with its bones.Skeleton).Skeleton).<ChatLoader.Dots />
<ChatLoader.Pulse />
<ChatLoader.Spinner />
<ChatLoader.Skeleton />Every loader accepts size. On ChatLoader.Skeleton, the size flows to the avatar and line bones.
<ChatLoader.Dots size="sm" />
<ChatLoader.Dots size="md" />
<ChatLoader.Dots size="lg" />
<ChatLoader.Skeleton size="sm" />
<ChatLoader.Skeleton size="md" />
<ChatLoader.Skeleton size="lg" />Pass label to announce the loader to screen readers as a busy progress indicator. Without a label, the loader is decorative and hidden from screen readers.
<ChatLoader.Dots label="Assistant is typing" />
<ChatLoader.Skeleton label="Loading message" />variant and animation on ChatLoader.Skeleton are forwarded to every bone.
<ChatLoader.Skeleton variant="shimmer" />
<ChatLoader.Skeleton variant="pulse" />
<ChatLoader.Skeleton variant="none" />Compose the bones to match your message layout. Bones accept every heroui-native Skeleton prop, and a width class overrides the default line width.
<ChatLoader.Skeleton>
<ChatLoader.SkeletonBlock className="items-end">
<ChatLoader.SkeletonLine className="w-3/4" />
<ChatLoader.SkeletonLine className="w-1/2" />
</ChatLoader.SkeletonBlock>
<ChatLoader.SkeletonAvatar />
</ChatLoader.Skeleton>A line bone with a height class stands in for an image or file preview.
<ChatLoader.Skeleton>
<ChatLoader.SkeletonAvatar />
<ChatLoader.SkeletonBlock>
<ChatLoader.SkeletonLine />
<ChatLoader.SkeletonLine />
<ChatLoader.SkeletonLine className="mt-1 h-28 rounded-2xl" />
</ChatLoader.SkeletonBlock>
</ChatLoader.Skeleton>Dots and Pulse run CSS keyframe loops that you can tune with animation. Every field is optional.
<ChatLoader.Dots
animation={{ bounce: { duration: 800, stagger: 160, opacity: [0.2, 1] } }}
/>
<ChatLoader.Pulse animation={{ pulse: { duration: 2400, scale: [0.6, 1] } }} />
<ChatLoader.Dots animation="disabled" /><ChatLoader.Dots classNames={{ dot: 'bg-accent' }} />
<ChatLoader.Pulse className="bg-success" />
<ChatLoader.Spinner color="warning" />import { Button, Surface } from 'heroui-native';
import { ChatLoader, TextShimmer } from 'heroui-native-pro';
import { useState } from 'react';
import { Text, View } from 'react-native';
const TYPING_PHASE = 0;
const THINKING_PHASE = 1;
const STREAMING_PHASE = 2;
const PHASE_COUNT = 3;
export default function ChatLoaderExample() {
const [phase, setPhase] = useState(TYPING_PHASE);
return (
<View className="flex-1 px-5 items-center justify-center">
<View className="w-full gap-4">
<Surface variant="secondary" className="self-end rounded-3xl px-4 py-3">
<Text className="text-sm text-foreground">
Can you draft a reply to the client?
</Text>
</Surface>
{phase === TYPING_PHASE ? (
<Surface
variant="secondary"
className="self-start rounded-3xl px-4 py-4"
>
<ChatLoader.Dots label="Assistant is typing" />
</Surface>
) : null}
{phase === THINKING_PHASE ? (
<View className="flex-row items-center gap-2">
<ChatLoader.Pulse label="Assistant is thinking" />
<TextShimmer
className="text-sm"
classNames={{ container: 'self-center' }}
>
Thinking...
</TextShimmer>
</View>
) : null}
{phase === STREAMING_PHASE ? (
<ChatLoader.Skeleton label="Loading reply" />
) : null}
<Button
variant="secondary"
size="sm"
className="self-center mt-4"
onPress={() => setPhase((current) => (current + 1) % PHASE_COUNT)}
>
<Button.Label>Next state</Button.Label>
</Button>
</View>
</View>
);
}| prop | type | default | description |
|---|---|---|---|
size | 'sm' | 'md' | 'lg' | 'md' | Size of the dots |
label | string | - | Accessible label. Omit it for a decorative loader |
className | string | - | Additional CSS classes for the container |
classNames | ElementSlots<DotsSlots> | - | Additional CSS classes for the container and dot slots |
styles | ChatLoaderDotsStyles | - | Inline styles for the container and dot slots |
animation | ChatLoaderDotsAnimation | - | Animation configuration |
isAnimatedStyleActive | boolean | true | When false, the bounce is not applied, so you can style the dots |
...ViewProps | ViewProps | - | All standard React Native View props are supported |
| type | description |
|---|---|
true | undefined | Default bounce |
false | 'disabled' | Static dots |
'disable-all' | Static dots, cascaded to animated descendants |
{ bounce?: ChatLoaderDotsBounceConfig; state? } | Custom bounce configuration |
| prop | type | default | description |
|---|---|---|---|
duration | number | 1200 | Duration of one bounce cycle, in milliseconds |
stagger | number | 120 | Delay between two consecutive dots, in milliseconds |
easing | CSSAnimationTimingFunction | 'ease-in-out' | Timing function of each keyframe segment |
opacity | [number, number] | [0.35, 1] | Opacity at rest and at the peak |
scale | [number, number] | [0.85, 1] | Scale at rest and at the peak |
| prop | type | default | description |
|---|---|---|---|
size | 'sm' | 'md' | 'lg' | 'md' | Size of the dot |
label | string | - | Accessible label. Omit it for a decorative loader |
className | string | - | Additional CSS classes for the dot |
animation | ChatLoaderPulseAnimation | - | Animation configuration |
isAnimatedStyleActive | boolean | true | When false, the pulse is not applied, so you can style the dot |
...ViewProps | ViewProps | - | All standard React Native View props are supported |
| type | description |
|---|---|
true | undefined | Default pulse |
false | 'disabled' | Static dot |
'disable-all' | Static dot, cascaded to animated descendants |
{ pulse?: ChatLoaderPulseConfig; state? } | Custom pulse configuration |
| prop | type | default | description |
|---|---|---|---|
duration | number | 1400 | Duration of one pulse cycle, in milliseconds |
easing | CSSAnimationTimingFunction | 'ease-in-out' | Timing function of each keyframe segment |
opacity | [number, number] | [0.45, 1] | Opacity at rest and at the peak |
scale | [number, number] | [0.92, 1] | Scale at rest and at the peak |
| prop | type | default | description |
|---|---|---|---|
size | 'sm' | 'md' | 'lg' | 'md' | Size of the spinner |
label | string | - | Accessible label. Omit it for a decorative loader |
className | string | - | Additional CSS classes for the spinner |
...SpinnerProps | SpinnerProps | - | All heroui-native Spinner props (color, animation, …) |
| prop | type | default | description |
|---|---|---|---|
children | ReactNode | - | Custom skeleton anatomy. Defaults to an avatar next to a block of three lines |
size | 'sm' | 'md' | 'lg' | 'md' | Size of the avatar and line bones |
variant | 'shimmer' | 'pulse' | 'none' | 'shimmer' | Animation variant of the bones |
label | string | - | Accessible label announced by screen readers. Without it, the skeleton is hidden from screen readers |
className | string | - | Additional CSS classes for the row container |
animation | ChatLoaderSkeletonAnimation | - | Animation configuration forwarded to every bone |
...ViewProps | ViewProps | - | All standard React Native View props are supported |
Animation configuration forwarded to every bone. It accepts the heroui-native SkeletonRootAnimation values. Can be:
false or "disabled": Disable bone animations"disable-all": Disable bone animations and cascade to all animated descendantstrue or undefined: Use default animationsobject: Custom entering, exiting, shimmer, and pulse configuration, as on heroui-native Skeleton| prop | type | default | description |
|---|---|---|---|
variant | 'shimmer' | 'pulse' | 'none' | Inherited | Animation variant. Overrides the parent variant |
className | string | - | Additional CSS classes for the bone |
animation | SkeletonRootAnimation | Inherited | Animation configuration. Overrides the parent animation |
...SkeletonProps | SkeletonProps | - | All heroui-native Skeleton props except children and isLoading |
| prop | type | default | description |
|---|---|---|---|
children | ReactNode | - | Bones stacked in the column, usually SkeletonLines |
className | string | - | Additional CSS classes for the column |
...ViewProps | ViewProps | - | All standard React Native View props are supported |
| prop | type | default | description |
|---|---|---|---|
variant | 'shimmer' | 'pulse' | 'none' | Inherited | Animation variant. Overrides the parent variant |
className | string | - | Additional CSS classes for the bone. A width class overrides the default width |
animation | SkeletonRootAnimation | Inherited | Animation configuration. Overrides the parent animation |
...SkeletonProps | SkeletonProps | - | All heroui-native Skeleton props except children and isLoading |
With a label, a loader is exposed as a focusable progressbar that announces the label and a busy state. Without one, it is hidden from screen readers (accessibilityElementsHidden / importantForAccessibility="no-hide-descendants"), matching the web aria-hidden behavior.
Dots and Pulse stop animating and render at a static 70% opacity when the system "Reduce Motion" setting is on. The skeleton bones and the spinner follow heroui-native's own reduced-motion handling.