Skip to main content

Spinner

Spinner is a loading indicator that inherits color from its parent element.

Open in Storybook

Import

import { Spinner } from "@tosui/react";

Basic Usage

Sizes

Colors

Spinner inherits color from its parent. Set the parent's color to change the spinner color.

Common Patterns

Button Loading State

Button has built-in loading support:

Centered Loading

Loading...

Inline Loading

Checking availability...

Full Page Loading

function PageLoader() {
return (
<Box
position="fixed"
inset={0}
display="flex"
alignItems="center"
justifyContent="center"
bg="background"
zIndex="overlay"
>
<VStack gap={4}>
<Spinner size="lg" />
<Text>Loading application...</Text>
</VStack>
</Box>
);
}

Props Reference

PropTypeDefaultDescription
size"sm" | "md" | "lg""md"Spinner size
asElementType"span"HTML element to render

Size Dimensions

SizeWidth/Height
sm1em
md1.5em
lg2em

Accessibility

  • Uses role="status" with aria-label="Loading"
  • Communicates loading state to screen readers

TypeScript

import { Spinner, type SpinnerSize, type SpinnerProps } from "@tosui/react";