Skeleton

Skeleton

HkSkeleton is the shimmering placeholder block: a rounded bar of the right size standing where content will be, so a layout keeps its shape instead of jumping when the data lands.

  • A whole stack of rows with one spacing step between them is an HkSkeletonList, which is Vue-only and composes this atom.
  • An unnamed wait — a save, a sign-in, a navigation — is an HkSpinner; a skeleton only makes sense when the shape of the answer is already known.
  • Once the load finishes with nothing in it, the placeholder is replaced by an HkEmptyState, not by a blank region.

Import

tsx
1
import { HkSkeleton, type SkeletonTone } from "@celestia-island/hikari";
rust
1
2
use hikari_components::*;          // Skeleton, SkeletonTone
use hikari_components::prelude::*; // rsx!, VNode

Width, height and radius

width and height are CSS lengths, so a line of text on a card is 100% wide and 16px tall while a typical avatar is a square with a circular radius. radius sets the corner treatment — pass "50%" for a circle, or any token the sheet knows. animated (on by default) runs the shimmer sweep; turning it off gives a still block, which is the calmer choice for a region that reloads often.

Tone

tone picks the block's ink: primary (the default) or muted, the quieter grey used when the placeholder sits on a surface that is already tinted. Both tones shimmer; only the resting colour changes.

Rows in the Rust mirror

The Rust mirror keeps one extra convenience that Vue does not have: rows renders N stacked lines inside the sheet's own list container, every row full width except the last, which takes 60% so the block reads as text rather than as a solid bar. rows of one (or none) is exactly the Vue atom — see the API note below, and prefer HkSkeletonList on the Vue side.

Accessibility

  • Every block is aria-hidden: the placeholder is decoration, and a screen reader must not announce a stack of empty divs.
  • Announce the wait on the container instead — aria-busy="true" on the region that is loading, cleared when the data arrives.
  • The shimmer is a stylesheet animation; there is no prop to stop it per instance beyond animated={false}. Offer that still variant where motion would be distracting.
  • Size the blocks from the real content's metrics; a placeholder that changes the layout on load is worse than no placeholder.

API

Vue

Props

NameTypeDefaultRequired
widthString"100%"—
heightString"16px"—
radiusString"var(--hk-radius-sm, 4px)"—
animatedBooleantrue—
toneString as PropType<SkeletonTone>"primary"—

Rust

Props — Skeleton

PropTypeDefaultDescription
widthString"100%".to_string()Vue default "100%".
heightString"16px".to_string()Vue default "16px".
radiusString"var(--hk-radius-sm, 4px)".to_string()Vue default "var(--hk-radius-sm, 4px)".
animatedbooltrueShimmer sweep (data-animated; Vue default true, false omits the attribute entirely).
toneSkeletonToneSkeletonTone::PrimaryVue default "primary".
rowsOption<u32>NoneMirror-only rows convenience — None is the Vue atom (see the header delta).

Related components

  • HkSkeletonList — a stack of these blocks with one gap and one tone.
  • HkSpinner — a busy indicator for a wait with no known shape.
  • HkEmptyState — the panel for a finished load with nothing in it.
  • HkProgressBar — a measurable wait shown as a track.