Shapes
Whatever shape the class says: text lines, a circle for an avatar, a picture, a row of buttons. Watch one for a few seconds: the outline and the hatch are redrawn three times over, slowly.
A placeholder someone sketched in pencil: a pale hatch inside a rough ruled outline that boils gently between three redrawn frames. It costs no ink per instance, so a page of hundreds is as cheap as one.
npx shadcn@latest add @wobko/skeleton第一次使用?先把 registry 加进 components.json。 如何安装
Whatever shape the class says: text lines, a circle for an avatar, a picture, a row of buttons. Watch one for a few seconds: the outline and the hatch are redrawn three times over, slowly.
The skeleton of a profile card placed inside the real Card, so the page does not jump when the words come in.
The skeleton and the content occupy the same room, so nothing moves when the swap happens. The region says it is busy while it waits; press Reload to see it again.
Official `skeleton-demo`: an avatar circle beside two lines of text, shaped only by classes. Each placeholder is a pale pencil hatch inside a rough outline that redraws itself slowly (three frames, each starting at its own phase); reduced motion holds it still.
Official `skeleton-card`: a picture-sized block over two lines of text. The same one-line classes, no props; hundreds of these on a page cost about what one does, because the drawing is CSS masks from a few shared tiles.
An empty div. Shape it with classes exactly as with shadcn's (h-4 w-[250px], size-12 rounded-full). The pencil is CSS: the hatch and the outline are masks made from a few tiny drawn tiles, defined once per page in one hoisted stylesheet; three redrawn frames of each are stepped through slowly. A rounded-full box gets a drawn circle.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| className | string | - | Its size and shape: any width and height, rounded-full for a circle. Colors are the theme's pencil and paper tokens. |
| seed | string | number | - | Picks the phase of the boil this skeleton starts on, so a page of them does not flicker in unison. Default: derived from useId(). |
CLI 会复制进你项目的文件。
正在加载源码