Skeleton

Placeholders that keep the loaded layout, alone or grouped.

  • Composed
  • In the first release
import { Skeleton, skeletonPrimitive } from "nitro-ui-sdk/skeleton";
HeroUI Native
SkeletonSkeletonGroup
Expo UI
No counterpart
  • Skeleton example screen, light appearance
    Light
  • Skeleton example screen, dark appearance
    Dark
On this page

Skeleton holds the shape of content that has not loaded. Use a preset for a list, a card, or lines of text. Use Circle, Rect, and Line when the layout is your own. Use Skeleton.Group when several placeholders are one loading moment.

The shimmer is a native gradient. It does not run a JavaScript loop. Reduced motion leaves the placeholders static.

Anatomy

<Skeleton.Group label="Loading feed" loading>
  <Skeleton.Root label="Title" variant="text" count={2} />
  <Skeleton.Root label="Body" variant="text" count={3} />
</Skeleton.Group>
Part Description
Root One placeholder. It renders a preset, or your shapes, while loading is true.
Group Shares loading and one shimmer across the roots inside it.
Shape A rounded block. Circle and Rect are shapes with a default part.
Line A text-height bar.
Circle A round shape.
Rect A rectangular shape.

While a root is loading and you pass no children, it renders the preset for variant. Pass children to draw your own shapes. When loading is false, the root renders only children.

Usage

import { Skeleton } from "nitro-ui-sdk/skeleton";

export function FeedPlaceholder() {
  return <Skeleton.Root label="Loading feed" variant="row" count={2} />;
}

Variants and sizes

variant is row, card, or text. There is one size, content. count sets how many rows or lines the preset draws. A card ignores count and draws one card.

<>
  <Skeleton.Root label="Loading card" variant="card" />
  <Skeleton.Root label="Loading article" variant="text" count={3} />
</>

States

loading defaults to true. A group overrides loading on every root inside it. A nested group inherits that same loading state, shimmer, and busy region, so it does not start a second one. The group frame stays mounted when loading ends, and only the busy flag and shimmer change. reducedMotion follows the theme unless you pass it. The shimmer runs only while loading and motion is allowed. A grouped root does not start a second shimmer and does not announce itself.

Controlled

loading is controlled by the parent. Skeleton does not toggle itself.

const [loading, setLoading] = useState(true);

<Skeleton.Root label="Loading feed" variant="row" loading={loading}>
  {loading ? null : <Text>Library is ready</Text>}
</Skeleton.Root>

Liquid Glass

Skeleton does not draw Liquid Glass. Placeholders use opaque surface and surfaceTertiary.

Props

Root

Prop Type Default Description
label string — Accessible name of the busy region. Required.
busyLabel string — Spoken busy value.
variant "row" | "card" | "text" "row" Preset used when there are no children.
count number 2 for rows, 3 for text How many preset rows or lines.
loading boolean true Ignored inside a group, which owns the flag.
reducedMotion boolean theme Forces the static placeholder.
styles SkeletonStyles — Per-part style resolvers.
api Controller<SkeletonActions> — Attached controller.
agentId string — Stable agent id.
layout layout — Extra layout merged onto the root.

Group

Prop Type Default Description
label string — Name of the single busy region. Required.
busyLabel string — Spoken busy value.
loading boolean true Toggles every root in the group.
api Controller<SkeletonActions> — Reads the group’s loading state.
agentId string — Stable agent id.
layout layout — Layout of the busy region.

Shape, Line, Circle, Rect

Shape and Rect take width, height, and radius. Line takes width and height. Circle takes size (default 40).

Controller API

import { skeletonPrimitive } from "nitro-ui-sdk/skeleton";

const api = skeletonPrimitive.createApi();
api.current?.getState();
Action Signature Result
getState () => SkeletonState loading, animated, and reducedMotion.

Styles

The resolver receives tokens, variant, size ("content"), and state.

<Skeleton.Root
  label="Loading feed"
  styles={{
    line: ({ tokens }) => ({
      style: { background: tokens.colors.surfaceTertiary, cornerRadius: 6 },
    }),
  }}
/>

Accessibility

A root that owns its presentation is one busy text region named by label. A group is that region for every root inside it, so a feed does not announce once per line. Nested roots are accessibilityHidden. The shimmer is not an accessibility element. Reduced motion removes the animation and leaves the placeholders.

Agent API

Read-only. Role status. The name is label, the value is busyLabel, and the state is { busy: loading }. A grouped root does not register. The entry goes away when loading ends.

Platform notes

iOS Android
Shimmer CAGradientLayer animation on KitShimmerView. One overlay per root or per group. ValueAnimator and a LinearGradient on the same view.
Static motion animating is false, and the native view is not mounted. Same flag.
Verification Built and exercised by the iOS harness on the lanes simulator. Kotlin is written to compile and was not built on this machine. There is no Android NDK here.