Skip to content

Loader

Loader components provide visual feedback to users while content is being loaded, data is being fetched, or actions are being processed. The component supports two distinct variants — an animated spinner for indeterminate loading and a progress bar for determinate, percentage-based loading.

Loading Code Block...

A basic spinner loader with default settings.

Loading Code Block...

The component supports two variants:

VariantDescription
spinnerAnimated circular spinner for indeterminate loading states
progressHorizontal bar with percentage for determinate loading

The spinner variant supports five size options:

SizeDimensionsText size
sm24×24 pxtext-xs
md32×32 pxtext-xs
lg40×40 pxtext-sm
xl48×48 pxtext-base
xxl56×56 pxtext-base
sm
md
lg
xl
xxl
Loading Code Block...

When using the progress variant with showPercentage, the percentage label can be placed in three positions. Use the interactive demo below to adjust the progress value and test the available positions:

PositionDescription
top-leftPercentage text aligned to the left above the bar
top-rightPercentage text aligned to the right above the bar
centerPercentage text displayed inline to the right of the bar
45%
45%
Loading Code Block...

PropsDefaultTypeDescription
variant'spinner''spinner' | 'progress'The loading indicator variant to render.
text-stringOptional text displayed below the spinner or progress bar.
primaryColor'bg-theme-accent-primary'stringColour of the active/filled portion. Accepts Tailwind classes (e.g. 'text-blue-500', 'bg-green-600') or hex values (e.g. '#00C853').
secondaryColor'text-white'stringColour of the inactive/track portion (spinner only). Accepts Tailwind classes or hex values.
PropsDefaultTypeDescription
size'md''sm' | 'md' | 'lg' | 'xl' | 'xxl'The size of the spinner. Controls both the SVG dimensions and accompanying text size.
PropsDefaultTypeDescription
progressPercentage20numberThe current progress value. Values outside `[0, 100]` are clamped.
showPercentagefalsebooleanWhether to display the numeric percentage alongside the progress bar.
percentagePosition'top-left''top-left' | 'top-right' | 'center'Position of the percentage text relative to the progress bar. Only applies when showPercentage is true.
  • The spinner SVG uses aria-hidden="true" since it is purely decorative — the loading state message should be conveyed via adjacent text
  • Use the text prop to provide a human-readable loading message (e.g. “Loading data…”)
  • For progress bars, the numeric percentage provides concrete feedback to assistive technologies
  • Consider using aria-live="polite" on the container when dynamically showing/hiding loaders