Skeleton
A placeholder loader shown while content is loading.
When to use
- Indicating that content is loading.
- Building loading states for cards, lists, and avatars.
API
Skeleton::new()
Creates a skeleton element.
| Method | Type | Default | Description |
|---|---|---|---|
.w(width) | impl Into<DefiniteLength> | — | Custom width |
.h(height) | impl Into<DefiniteLength> | — | Custom height |
.circle(circle) | bool | false | Circular shape (for avatar placeholders) |
Usage
rust
use gpui::{Component, div, prelude::*};
use components::Skeleton;
div()
.child(Component::new(Skeleton::new().w(px(100.0)).h(px(20.0))))
.child(Component::new(Skeleton::new().circle(true).w(px(40.0)).h(px(40.0))))Copy the source
crates/components/src/skeleton.rs — self-contained, stateless, and free to modify.