Skeleton
A still placeholder shaped like the content that is loading.
SourceStyles source@monoline/react 0.5.0Markdown for AI toolsstable
- Built on native elements
- aria-hidden: it carries no information.
- Pair with an aria-busy region or a Spinner so loading is announced once.
- Styles in one file:
13-loading.css
Import
import '@monoline/css';
import {Skeleton} from '@monoline/react';
Not installed yet? Pick a route.
Copies the source and its styles into your project.
npx monoline add skeleton
Usage
import {Skeleton} from '@monoline/react';
<div style={{display: 'grid', gap: 'var(--s3)', maxWidth: 420}}>
<Skeleton style={{width: '60%'}} />
<Skeleton style={{width: '90%'}} />
<Skeleton variant="hatch" />
</div>
Examples
Lines and block
Props
SkeletonProps
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "line" | "block" | "hatch" | 'line' | `block` is a tall panel; `hatch` shows the hatch pattern. |
Data Attributes
State is exposed through attributes. Style it with these selectors, not with class toggles.
This component sets no state attributes.
CSS classes
| Class | Stylesheet |
|---|---|
.skeleton | 13-loading.css |
.skeleton-block | 13-loading.css |
.skeleton-hatch | 13-loading.css |
.spinner | 13-loading.css |
Customization
Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.
app.css
.skeleton {
border-color: var(--accent);
}
Accessibility
- aria-hidden: it carries no information.
- Pair with an aria-busy region or a Spinner so loading is announced once.