View as Markdown

API reference: @salmonui/notifications/spinner

Spinnercomponent

import { Spinner } from '@salmonui/notifications/spinner';
function Spinner({ label, size, loading, overlay, indicator, children, className, style, ref, ...rest }: SpinnerProps): import("react").JSX.Element | null;

A loading indicator. <Spinner label="Loading orders" /> announces its label; <Spinner loading={pending}>{content}</Spinner> covers content while loading is true.

Props: SpinnerProps

Spinner props (7)
NameSignatureDescription
labeloptionallabel?: string;

Accessible loading text. With a label the spinner is a role="status" region carrying the visually hidden text; without one it is decorative (aria-hidden), and the busy state belongs to its container (aria-busy).

sizeoptionalsize?: SpinnerSize | number;

'sm' (16 px), 'md' (24 px, default), 'lg' (32 px) or a diameter in pixels.

loadingoptionalloading?: boolean;

Shows the indicator (default true). With children, loading={false} renders only the children, and loading keeps their size while they are hidden and inert.

overlayoptionaloverlay?: boolean;

Covers the nearest positioned ancestor with a scrim and centers the indicator.

indicatoroptionalindicator?: ReactNode;

Replaces the built-in ring.

childrenoptionalchildren?: ReactNode;

Content the spinner covers while loading; the wrapper gets aria-busy.

refoptionalref?: Ref<HTMLElement>;

The root element: the spinner <span>, or the wrapper <div> when children are given.