Spinner
A spinning circle that shows something is loading.
Usage
import { Spinner } from '@leverui/components';
<Spinner />
Examples
Sizes
Use the size prop to change the size of the spinner.
Colors
Use the colorPalette prop to change the color scheme of the spinner.
Custom Color
Set the CSS color property to pass a custom color to the spinner.
Track Color
Use the --leverui-spinner-track-color variable to change the color of the spinner's track.
Custom Speed
Set the CSS animation-duration property to change the speed of the spinner.
Thickness
Set the CSS border-width property to change the thickness of the spinner.
Custom Indicator
Use the asChild prop to render a custom icon as the spinner.
Label
Compose the spinner with a label to provide additional context.
Loading...
Overlay
Compose spinner with the Center component to overlay the spinner on top of another component.
Weekly sales report
Sales rose in all three regions this week. The full report has a chart for each product line and a short note on what changed since last week.
Guides
Import @leverui/components/styles.css once in your app.
size is responsive. colorPalette sets the
--leverui-colors-color-palette-* variables on the spinner, for use in a class
or in style. Change the color and speed in your own class. Set
--leverui-spinner-track-color for the track.
.loading-indicator {
color: var(--leverui-colors-blue-500);
--leverui-spinner-track-color: transparent;
animation-duration: 800ms;
}
Customize with class and style. No CSS objects, general style props, or
custom recipes.
Spinner does not add a status role or an accessible name. Standing alone,
give it role="status" and a short label. Next to text that already says
something is loading, hide it from assistive technology.
Props
Root
| Prop | Default | Type | Description |
|---|---|---|---|
size | md | 'inherit' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' or responsive map | Spinner size. |
colorPalette | — | string | Color palette, passed as CSS variables. |
as | span | Native HTML tag or svg | HTML tag to render. |
asChild | — | Solid render function | Render your own element with the spinner's props. |
unstyled | false | boolean | Turn off the Lever UI styles. |
SpinnerPropsProvider sets default props for the spinners inside it. A prop on
a spinner wins. The values are reactive.