Skeleton

Loading states are skullet skeletons. Wrap what you would render once the data arrives; while it loads, skullet lays that content out unseen and draws a skeleton the exact same shape over it, so nothing moves when it lands.

Rows

Pass data and render from it. While it is null, sample is laid out instead and drawn as bars: one per line of text, a block per control. Colours are skeleton/base and skeleton/highlight, so every theme gets its own, and the shimmer is slow. Press the button to load again.

Loading your inbox

Timing and motion

Skullet’s smart reveal holds the skeleton back 150ms, so a fast load never flashes one: opening an email and J and K stay instant. Slower loads come in where their skeleton was, rows in screen order. Give a list an id and skullet remembers its real shape for the next visit. Everything holds still under reduced motion.

Loading your inbox

Usage

import { Skeleton, SkeletonBox } from "@kuori/ui/skeleton";
<Skeleton data={emails} sample={SAMPLE}>{(emails) => <EmailList emails={emails} />}</Skeleton>

Skeleton

PropTypeDescription
data
Tnullundefined
Loading while empty; passed to children once it isn't
sample
T
Stands in for data to draw the first skeleton
childrenRequired
(data: T) => ReactNodeReactNode
What to render. With plain children, use loading
loading
boolean
Shows the skeleton, even over data, for a refetch
id
string
Remembers the real shape across visits under this key
label
string
Read to screen readers while loading: “Loading your inbox”
onReveal
() => void
Called once the content has come in
className
string
Additional CSS classes

SkeletonBox

PropTypeDescription
width
stringnumber
A placeholder block's width
height
stringnumber
Its height
radius
string
Its corner radiusDefault: radius/4