--- title: Spinner description: An indicator that can be used to show a loading state. base: base component: true --- ## Installation Command Manual ```bash npx shadcn@latest add spinner ``` Copy and paste the following code into your project. Update the import paths to match your project setup. ## Usage ```tsx import { Spinner } from "@/components/ui/spinner" ``` ```tsx ``` ## Customization You can replace the default spinner icon with any other icon by editing the `Spinner` component. ```tsx showLineNumbers title="components/ui/spinner.tsx" import { cn } from "cn" import { LoaderIcon } from "lucide-react" function Spinner({ className, ...props }: React.ComponentProps<"svg">) { return ( ) } export { Spinner } ``` ## Size Use the `size-*` utility class to change the size of the spinner. ## Button Add a spinner to a button to indicate a loading state. Place the `` before the label with `data-icon="inline-start"` for a start position, or after the label with `data-icon="inline-end"` for an end position. ## Badge Add a spinner to a badge to indicate a loading state. Place the `` before the label with `data-icon="inline-start"` for a start position, or after the label with `data-icon="inline-end"` for an end position. ## Input Group ## Empty ## RTL To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).