Skeleton
Placeholder shaped like the content it stands in for. A soft highlight sweeps across; with reduced motion it is a still block. Layout.
Open playgroundAbout
Skeleton is a React component in the Layout category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { Skeleton } from "@ashutoshswamy/smoui" and set variant, width, lines among its 4 props.
Install
npm i @ashutoshswamy/smouiUsage
import { Skeleton } from "@ashutoshswamy/smoui";
<div aria-busy="true">
<Skeleton variant="circle" height={48} />
<Skeleton variant="text" lines={3} />
<Skeleton height={96} radius={16} />
</div>Props 4
- variant
Text draws lines (the last shorter), circle is round, rect is a block.
"text""circle""rect"default"rect"- width / height
Size. Text height is per line.
numberstring- lines
Lines for text.
numberdefault3- radius
Corner radius for rect.
numberdefault12
More layout components
- AccordionStacked disclosures. The plus turns to a cross and the answer unfolds on a spring.
- BentoGridMixed-size tiles that rise in as a stagger, lift on hover, with a light that trails the cursor.
- CarouselDrag or flick: slides coast then snap to centre on a spring while the neighbours shrink and dim.
- EmptyStateWhat to show when there is nothing yet. Cards fan out behind an icon, the text rises in and hovering spreads the cards.
- MasonryTiles of different heights packed into the shortest column, every column ending on the same line. They rise in one after another and glide to their new place when the column count changes.
- ReorderListA list you reorder by its grip. Neighbours slide aside on a spring, and the keyboard works too: focus the grip, press arrow up or down. Moves are announced.