Sizes and colors
Size it with size-*; the scribble is redrawn for the size (fewer, wider turns when it is small). It draws in whatever text color it sits in. With reduced motion on, every one of these stands still, whole.
A pencil that will not stop scribbling: a hand-wound spiral whose line is drawn and undrawn round and round, in the color of the text around it. Still, and whole, when motion is reduced. Stubby can write instead, in three frames like a flip book.
npx shadcn@latest add @wobko/spinner第一次使用?先把 registry 加进 components.json。 如何安装
Size it with size-*; the scribble is redrawn for the size (fewer, wider turns when it is small). It draws in whatever text color it sits in. With reduced motion on, every one of these stands still, whole.
A spinner in front of a label is shadcn's pattern. The button is disabled while the request runs and says what is happening; press it to see a save go through.
For a page or a panel that is loading rather than a button: Stubby writes in three frames, flipped like a flip book, and the words say what they are waiting for. The role=status carries the name. With reduced motion he holds still with the scribble finished.
Official `spinner-demo`: a muted row that reads "Processing payment..." with a spinner as its media and the amount at the end. The scribble is a hand-wound spiral whose line is drawn and undrawn round and round; with reduced motion it stands still, whole.
Official `spinner-basic`: the bare `<Spinner />`, 16 px by default. It is `role="status"` with the name "Loading", and it draws in the current text color.
Official `spinner-button`: a spinner as the first child of a disabled small button, in the default, outline and secondary variants. The button dashes itself when disabled, so the wait shows in the outline as well as in the scribble.
Official `spinner-badge`: Syncing, Updating and Processing badges in the default, secondary and outline variants, each with a spinner in front of the word.
Official `spinner-input-group`: a disabled field with a spinner at its end, and a disabled textarea whose footer says "Validating..." beside a send button. The group draws itself dashed because its control is disabled. Only change: the controls get an `aria-label`.
Official `spinner-empty`: an Empty state whose icon slip holds a spinner, with a title, a sentence and a Cancel button. For a whole page or panel that is waiting, `variant="write"` on the Spinner has Stubby writing instead.
Official `spinner-color`: five 24 px spinners, each in its own text color. shadcn uses the palette's red, green, blue, yellow and purple; here they are red felt-tip, green pencil, blue biro, orange marker and grape marker (yellow highlighter is too pale to read as a line on paper).
Official `spinner-custom`: a spinner is nothing more than a status role around an icon that turns, so you can build one from any glyph. Here the hand-drawn `loader-circle` spins with `animate-spin` (and stops for reduced motion, which Tailwind's utility alone does not do). A drawn icon must stay decorative, so the role and the name sit on a span around it instead of on the icon, as they do on the original's lucide svg.
Official `spinner-size`: `size-3`, `size-4`, `size-6` and `size-8`. The scribble is redrawn for each size (fewer, wider turns when it is small) rather than scaled, so the pencil line keeps its weight.
Official `spinner-item`: an outlined row for a download, with the spinner as icon media, a title and sizes, a Cancel button that appears from the `sm` breakpoint up, and a progress bar in the footer. The bar carries an `aria-label`, which the original lacks.
A role=status span (shadcn's is the svg itself, so its props are the span's) with an accessible name, wrapping an aria-hidden drawing. Size it with size-* like shadcn's (default size-4); the scribble is redrawn for the size, thinner and tighter when small. The line is a filled pen drawing hidden behind a mask whose stroke is dashed, and the dash slides round the line (Stubby is his own three drawings, shown one after the other); nothing is measured, so the whole thing renders on the server.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| variant | "scribble" | "loops" | "write" | "scribble" | scribble = the spiral, for buttons and badges. loops = a line of cursive loops written on and off, four times as wide as it is tall, for a wide inline wait. write = Stubby, the pencil-stub mascot, in three frames flipped like a flip book while he writes: for a page or a panel that is loading. |
| size | number | - | Pixels, if you would rather not use a size-* class: the side of a scribble, the height of the loops (their width is four times that), the height of Stubby. Default: the size-N in className, else 16 (Stubby: 64). |
| aria-label | string | "Loading" | The accessible name. Say what is loading ("Saving your page") when the surrounding text does not. |
| seed | string | number | - | Pins the hand: the same seed always draws the same scribble. Default: derived from useId(). |
CLI 会复制进你项目的文件。
正在加载源码