Basic example
The spinner component is mostly used as a loading indicator which comes in multiple colors, sizes, and styles separately or inside elements such as buttons to improve the user experience whenever data is being fetched from your server.
Use the following element with the animate-spin animation class to show a loading animation:
Colors
Change the colors of the spinner element using the fill and color utility classes.
Growing spinner
Use the .animate-[spinner-grow_0.75s_linear_infinite]
class if
you want the spinner/loader to grow instead of spin.
Use any text color utilities to add a color to growing spinner.
Alignment
Spinners can easily be resized, recolored, and quickly aligned.
Margin
Use margin utilities like .m-12
for easy spacing.
Flex
Use flexbox utilities to place spinners exactly where you need them in any situation.
Floats
Use the flexbox, text alignment, or float utility classes to easily align the spinners to left, right or center.
Text align
Use the following code to add spinner a text.
Size
Use h-{*}
and w-{*}
utility classes to create a
smaller spinner.
Use h-{*}
and w-{*}
utility classes to create a
bigger spinner.
Buttons
Use spinners within buttons to indicate an action is currently processing or taking place. You may also swap the text out of the spinner element and utilize button text as needed.
Border spinner
Add spinners to the button, with or without text:
Growing spinner
You can also use growing spinner in buttons: