# Spinner **Category**: react **URL**: https://heroui.com/en/docs/react/components/spinner **Source**: https://raw.githubusercontent.com/heroui-inc/heroui/refs/heads/v3/apps/docs/content/docs/en/react/components/(feedback)/spinner.mdx > A loading indicator component to show pending states *** ## Usage ```tsx import { Spinner } from '@heroui/react'; ``` ```tsx import {Spinner} from "@heroui/react"; export function SpinnerBasic() { return (
); } ``` ## Examples ### Colors ```tsx import {Spinner} from "@heroui/react"; export function SpinnerColors() { return (
Current
Accent
Success
Warning
Danger
); } ``` ### Sizes ```tsx import {Spinner} from "@heroui/react"; export function SpinnerSizes() { return (
Small
Medium
Large
Extra Large
); } ``` ### Speed Apply an animation utility to change how fast a single spinner rotates. Pair it with `motion-reduce:animate-none` so it stays still for users who prefer reduced motion. ```tsx import {Spinner} from "@heroui/react"; export function SpinnerSpeed() { return (
Slow
Default
Fast
); } ``` ## Customization ### Tailwind CSS ```tsx import {Spinner} from "@heroui/react"; export function CustomStyles() { return (
); } ``` ### Global CSS To customize the Spinner component classes, you can use the `@layer components` directive. [Learn more](https://tailwindcss.com/docs/adding-custom-styles#adding-component-classes). ```css @layer components { .spinner { @apply animate-spin; } .spinner--accent { color: var(--accent); } } ``` ## Styling Reference HeroUI follows the [BEM](https://bem.info/en/methodology/) methodology to ensure component variants and states are reusable and easy to customize. ### CSS Classes The Spinner component uses these CSS classes ([View source styles](https://github.com/heroui-inc/heroui/blob/v3/packages/styles/components/spinner.css)): #### Base & Size Classes [!toc] - `.spinner` - Base spinner styles with default size - `.spinner--sm` - Small size variant - `.spinner--md` - Medium size variant (default) - `.spinner--lg` - Large size variant - `.spinner--xl` - Extra large size variant #### Color Classes [!toc] - `.spinner--current` - Inherits current text color - `.spinner--accent` - Accent color variant - `.spinner--danger` - Danger color variant - `.spinner--success` - Success color variant - `.spinner--warning` - Warning color variant ## API Reference ### Spinner | Prop | Type | Default | Description | |------|------|---------|-------------| | `size` | `"sm" \| "md" \| "lg" \| "xl"` | `"md"` | Size of the spinner | | `color` | `"current" \| "accent" \| "success" \| "warning" \| "danger"` | `"accent"` | Color variant of the spinner | | `className` | `string` | - | Additional CSS classes | ## Related Components