Spinner

Spinner

HkSpinner is the small rotating busy indicator: five named sizes or an explicit pixel diameter, an optional caption beside the circle, and a centering mode that turns it into the standard "this region is loading" block.

  • When the wait has a measurable fraction, show it: an HkProgressBar or an HkProgressRing tells the user how long is left instead of only that something runs.
  • When the wait blocks the whole surface rather than one region, the HkLoadingVeil paints a dimmed, non-interactive backdrop with its own spinner.
  • When the content's shape is already known, a HkSkeleton placeholders that shape instead of spinning.

Import

tsx
1
import { HkSpinner, type SpinnerSize } from "@celestia-island/hikari";
rust
1
2
use hikari_components::*;          // Spinner, SpinnerSize, SpinnerTone
use hikari_components::prelude::*; // rsx!, VNode

Sizes

The five named steps are xs, sm, md (the default), lg and xl. A number is read as a pixel diameter and overrides the named class — handy for matching a glyph in a row — and a number wins over the class because only one of the two is emitted.

Caption and tone

text puts a short caption beside the circle — the verb of what is happening, already localized by the caller. tone="current" paints the spinner with currentcolor, which is what you want inside a filled button, a coloured banner or any surface whose text ink the spinner should match; the default primary keeps the theme's primary colour.

Loading reports
Syncing

Centering in a region

center switches the wrapper to the shared loading-state placement: a column layout with a minimum height floor, so a list or a panel that swaps its body for a spinner does not collapse. minHeight overrides that floor for tight containers — a string is passed through, a number is read as pixels — and it only matters together with center.

Loading invoices
Reloading the chart

Accessibility

  • The spinner is decorative: the circle itself carries no text, no role and no label, so it never announces "busy" on its own.
  • Name the work next to it — pass text, or put the spinner inside a container that is already announced as a busy region, and put aria-busy on the region while the request runs.
  • Pair a slow spinner with a caption that says what is happening rather than a bare animation, because motion alone conveys no cause.
  • Under reduced-motion preferences the animation is the CSS sheet's business, not the caller's: do not build a second spinner of your own to control it.

API

Vue

Props

NameTypeDefaultRequired
size<code>[String, Number] as PropType<SpinnerSize | number></code>"md"—
textStringundefined—
centerBooleanfalse—
tone<code>String as PropType<"primary" | "current"></code>"primary"—
minHeight<code>[String, Number] as PropType<string | number></code>undefined—

Rust

Props — Spinner

PropTypeDefaultDescription
sizeSpinnerSizeSpinnerSize::MdNamed size; emits the hk-spinner-<size> modifier class.
size_pxOption<f64>NoneVue's numeric size: a px diameter override emitted as an inline width/height style (takes precedence over the named class).
textOption<String>NoneOptional label rendered next to the circle (hk-spinner-text).
centerboolfalseCenter the spinner on both axes inside its container (the shared loading-state placement contract: column layout, min-height floor).
toneSpinnerToneSpinnerTone::PrimaryInk: theme primary (default) or currentcolor.
min_heightOption<String>NoneThe --hk-loading-min-height override; only meaningful with center (Vue: minHeight, string or px number).
classString""—
styleString""—

Related components

  • HkLoadingVeil — a fullscreen blocking wait with its own spinner.
  • HkProgressBar — a wait with a known fraction.
  • HkProgressRing — the same fraction as a circular arc.
  • HkSkeleton — placeholder shapes for a known layout.
  • HkEmptyState — the panel a region shows once loading finishes with nothing.
  • Button — a text button that carries a spinner while it commits.