Components · Feedback
Spinner
The pixel spinner, four square pixels lit in turn, for a wait of unknown length with no layout to hold.
import { Spinner } from "@botiverse/raft-ui";The pixel spinner is four square pixels that light up in turn. Use it while something loads for an unknown time and there is no layout to hold, such as a small area or a menu that fetches its items. Which loading indicator fits which wait is in Choosing a component.
When to use
Variants
sizescales the pixels:xsis 9.5px across,sm(the default) 12px,md14px andlg19px. Pick it by Size.- The spinner takes the color of the text around it.
variant="inverse"sets it in the inverse foreground, for a surface of the opposite lightness.
Size
A loading indicator matches what it stands in for: it holds the place of what will appear, so it takes that thing's size, and the line beside it takes that thing's type.
- Over media, the spinner sits on a
layer-veilcover and keeps its default color: the veil is the page's own color at 80%, so the ink that reads on the page reads on it, in both modes (Surfaces). - Don't make a placeholder small to make the wait look minor: a 9.5px spinner and a hint-colored caption in the middle of an empty panel read as an empty panel, and the person waits without knowing anything is happening.
Loading screen
When the app is starting and nothing is on screen yet, a loading screen shows the pixel loader in place of the spinner: the agents' pixel sprites light up in turn next to the Raft mark. A loading screen is a brand page, so it may show the logo (Brand). The pixel loader is a composition in the docs, not a raft-ui export.
Behavior
- Show the spinner only after the wait passes 1 second, so a fast load doesn't flash it. raft-ui doesn't delay it for you: a spinner often sits inline or in a button, where starting at once is right. A list skeleton, which is only for a slow load, does wait 1 second by default (Feedback).
- Where the old content stays on screen while the new loads, and the spinner is the only sign the click took, it waits 300ms instead. A second with no sign there reads as a missed click; under 300ms nothing changes. A tab's icon is the case that set this: while a tab loads a new page (Back, Forward, a link, Reload) the old page stays until the new one paints. A navigation inside the same page (a route change, a hash) shows no spinner at all, as in Chrome (Samuel, Kirby, Jasper, 2026-11-26, #proj-workspace:#436).
- Remove it the moment the wait ends.
- With
prefers-reduced-motion, the pixels stop and the first one stays lit (Motion).
Content
- Put a short line next to the spinner that says what is loading: "Loading messages", not "Loading…" (Writing).
Accessibility
Spinnerrendersrole="status"with the accessible name "Loading". Pass anaria-labelthat names what is loading.
Rules
API
Spinner
Also takes the attributes of its element.
Related
Changes
- 0.35.1 · FixedPanelNotice: a leading
Spinneris centred on the first line of text, in the 16px icon's column. - 0.22.0 · AddedBanner with a
Spinner: while something is still pending, such as a computer that hasn't connected yet, aSpinnerplaced as a direct child takes the icon's place. Banner puts it in the icon's column and centers it on the first line, so the text starts where it does after an icon. Use it in astatus="info"banner. - 0.21.1 · FixedMessageReferencePending, and any reference chip, holding a
Spinner: the spinner centers on the middle of the label's line, as an icon does.