Pass mock data as the child while
isLoading is true. The skeleton draws bones from what that child paints, so an empty child has no bones. When the content loads again, pass the previous data as the mock so the shape stays the same.Examples
- Basic Usage
- Mock Data
- Keep and Bone
- Changing Size
Properties
Required
The content. While
isLoading is true, pass mock data here. The skeleton draws bones from what this child paints, so an empty child has no bones.State
Constructors
NeoSkeleton.keep and NeoSkeleton.bone mark a part inside a NeoSkeleton. Outside a skeleton they show their child as it is.
NeoSkeleton.keep()
Shows a part as it is while the skeleton loads. A kept part stays live, so it takes taps and a screen reader can reach it.NeoSkeleton.bone()
Turns a part into one bone in its own shape, such as an avatar with initials.What Becomes a Bone
- Each line of text becomes a bar.
- Icons and images become rounded blocks.
- Shapes with nothing inside, such as a filled circle, become bones in their own shape.
- A surface with content inside, such as a
NeoCard, keeps its look. NeoButton,NeoDivider, andNeoTabBarstay as they are.NeoBadge,NeoToggleSwitch,NeoCheckbox, andNeoFluidCountereach become one bone.NeoSkeleton.keepandNeoSkeleton.bonetake precedence over these defaults.
Best Practices
- Pass mock data while loading. An empty child draws no bones.
- When the content loads again, pass the previous data as the mock so the shape stays the same.
- Put the skeleton in an
AnimatedSizewhen the loaded content can have a different size.
Behavior
- While loading, the bones shimmer. With reduced motion, they stay still and the content appears without a sweep.
- When loading ends, the content arrives behind a sweep from the top-left. Skeletons that finish in the same frame share one sweep.
- The skeleton always takes the size of its child, so content of a different size changes the box at once.
- While loading, only kept parts take taps. A screen reader hears “Loading” once, plus the kept parts.
- The skeleton records its child again when the child widget changes, when the theme changes, and on hot reload. An animation inside it is recorded again at most every 250 ms.

