Published on

6 Incredibly Easy Ways To Make A Spinner Collection With Tailwind CSS Better While Spending Less

Tags
Spinner Collection

What is Tailwind CSS?

Tailwind CSS is a utility-first CSS framework that focuses on creating personalized user interfaces quickly. It can gives you all the building blocks you are able to create personalized designs without having to fight to override irritating opinionated styles. Also, Tailwind CSS is a highly configurable, low-level CSS framework.

The description of Spinner Collection ui component

A super simple spinner collection, also see on codepen.io/egoistdeveloper/pen/kkyxzzn

Why use Tailwind CSS to make a Spinner Collection ui component?

  • It can make the building process of Spinner Collection ui component faster and more easily.
  • Enables building complex responsive layouts and components freely.
  • Minimum lines of CSS code in Spinner Collection component file.

The preview of Spinner Collection ui component

Free download of the Spinner Collection's source code

The source code of Spinner Collection ui component

<!-- Page Container -->
<div class="flex items-center justify-center min-h-screen bg-white">
    <div class="flex flex-col">
        <div class="flex space-x-24">
            <!-- Regular Spinners -->
            <div class="container space-y-10 relative">
                <h1 class="mb-8 text-xl font-semibold">
                    Regular Spinners
                </h1>

                <!-- Open Ring Examples -->
                <div class="flex flex-col">
                    <h4 class="mb-8">
                        Open Rings
                    </h4>

                    <div class="flex flex-row space-x-4">
                        <!-- Open Ring Spinner s1 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border border-solid border-yellow-500 border-t-transparent"></div>

                        <!-- Open Ring Spinner s2 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-2 border-solid border-blue-500 border-t-transparent"></div>

                        <!-- Open Ring Spinner s4 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-4 border-solid border-green-500 border-t-transparent"></div>

                        <!-- Open Ring Spinner s8 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-8 border-solid border-purple-500 border-t-transparent"></div>
                    </div>
                </div>

                <!-- Close Ring Examples -->
                <div class="flex flex-col">
                    <h4 class="mb-8">
                        Closed Rings
                    </h4>

                    <div class="flex flex-row space-x-16">
                        <!-- Closed Ring Spinner s1 -->
                        <div class="flex">
                            <div class="relative">
                                <!-- Outer Ring-->
                                <div class="w-12 h-12 rounded-full absolute
                            border border-solid border-gray-200"></div>

                                <!-- Inner Ring -->
                                <div class="w-12 h-12 rounded-full animate-spin absolute
                            border border-solid border-yellow-500 border-t-transparent"></div>
                            </div>
                        </div>

                        <!-- Closed Ring Spinner s2 -->
                        <div class="flex">
                            <div class="relative">
                                <!-- Outer Ring-->
                                <div class="w-12 h-12 rounded-full absolute
                            border-2 border-solid border-gray-200"></div>

                                <!-- Inner Ring -->
                                <div class="w-12 h-12 rounded-full animate-spin absolute
                            border-2 border-solid border-blue-500 border-t-transparent"></div>
                            </div>
                        </div>

                        <!-- Closed Ring Spinner s4 -->
                        <div class="flex">
                            <div class="relative">
                                <!-- Outer Ring-->
                                <div class="w-12 h-12 rounded-full absolute
                            border-4 border-solid border-gray-200"></div>

                                <!-- Inner Ring -->
                                <div class="w-12 h-12 rounded-full animate-spin absolute
                            border-4 border-solid border-green-500 border-t-transparent"></div>
                            </div>
                        </div>

                        <!-- Closed Ring Spinner s8 -->
                        <div class="flex">
                            <div class="relative">
                                <!-- Outer Ring-->
                                <div class="w-12 h-12 rounded-full absolute
                            border-8 border-solid border-gray-200"></div>

                                <!-- Inner Ring -->
                                <div class="w-12 h-12 rounded-full animate-spin absolute
                            border-8 border-solid border-purple-500 border-t-transparent"></div>
                            </div>
                        </div>
                    </div>

                </div>

                <!-- Edge X Ring Examples -->
                <div class="flex flex-col">
                    <h4 class="my-8">
                        Edge X Rings
                    </h4>

                    <div class="flex flex-row space-x-4">
                        <!-- Edge X Ring Spinner s1 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-x border-solid border-yellow-500 border-t-transparent"></div>

                        <!-- Edge X Ring Spinner s2 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-x-2 border-solid border-blue-500 border-t-transparent"></div>

                        <!-- Edge X Ring Spinner s4 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-x-4 border-solid border-green-500 border-t-transparent"></div>

                        <!-- Edge X Ring Spinner s8 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-x-8 border-solid border-purple-500 border-t-transparent"></div>
                    </div>
                </div>

                <!-- Edge Y Ring Examples -->
                <div class="flex flex-col">
                    <h4 class="mb-8">
                        Edge Y Rings
                    </h4>

                    <div class="flex flex-row space-x-4">
                        <!-- Edge Y Ring Spinner s1 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-y border-solid border-yellow-500 border-t-transparent"></div>

                        <!-- Edge Y Ring Spinner s2 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-y-2 border-solid border-blue-500 border-t-transparent"></div>

                        <!-- Edge Y Ring Spinner s4 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-y-4 border-solid border-green-500 border-t-transparent"></div>

                        <!-- Edge Y Ring Spinner s8 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-y-8 border-solid border-purple-500 border-t-transparent"></div>
                    </div>
                </div>
            </div>

            <!-- Dashed Spinners -->
            <div class="container space-y-10 relative">
                <h1 class="mb-8 text-xl font-semibold">
                    Dashed Spinners
                </h1>

                <!-- Open Ring Examples -->
                <div class="flex flex-col">
                    <h4 class="mb-8">
                        Open Rings
                    </h4>

                    <div class="flex flex-row space-x-4">
                        <!-- Open Ring Spinner s1 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border border-dashed border-yellow-500 border-t-transparent"></div>

                        <!-- Open Ring Spinner s2 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-2 border-dashed border-blue-500 border-t-transparent"></div>

                        <!-- Open Ring Spinner s4 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-4 border-dashed border-green-500 border-t-transparent"></div>

                        <!-- Open Ring Spinner s8 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-8 border-dashed border-purple-500 border-t-transparent"></div>
                    </div>
                </div>

                <!-- Close Ring Examples -->
                <div class="flex flex-col">
                    <h4 class="mb-8">
                        Closed Rings
                    </h4>

                    <div class="flex flex-row space-x-16">
                        <!-- Closed Ring Spinner s1 -->
                        <div class="flex">
                            <div class="relative">
                                <!-- Outer Ring-->
                                <div class="w-12 h-12 rounded-full absolute
                            border border-dashed border-gray-200"></div>

                                <!-- Inner Ring -->
                                <div class="w-12 h-12 rounded-full animate-spin absolute
                            border border-dashed border-yellow-500 border-t-transparent"></div>
                            </div>
                        </div>

                        <!-- Closed Ring Spinner s2 -->
                        <div class="flex">
                            <div class="relative">
                                <!-- Outer Ring-->
                                <div class="w-12 h-12 rounded-full absolute
                            border-2 border-dashed border-gray-200"></div>

                                <!-- Inner Ring -->
                                <div class="w-12 h-12 rounded-full animate-spin absolute
                            border-2 border-dashed border-blue-500 border-t-transparent"></div>
                            </div>
                        </div>

                        <!-- Closed Ring Spinner s4 -->
                        <div class="flex">
                            <div class="relative">
                                <!-- Outer Ring-->
                                <div class="w-12 h-12 rounded-full absolute
                            border-4 border-dashed border-gray-200"></div>

                                <!-- Inner Ring -->
                                <div class="w-12 h-12 rounded-full animate-spin absolute
                            border-4 border-dashed border-green-500 border-t-transparent"></div>
                            </div>
                        </div>

                        <!-- Closed Ring Spinner s8 -->
                        <div class="flex">
                            <div class="relative">
                                <!-- Outer Ring-->
                                <div class="w-12 h-12 rounded-full absolute
                            border-8 border-dashed border-gray-200"></div>

                                <!-- Inner Ring -->
                                <div class="w-12 h-12 rounded-full animate-spin absolute
                            border-8 border-dashed border-purple-500 border-t-transparent"></div>
                            </div>
                        </div>
                    </div>

                </div>

                <!-- Edge X Ring Examples -->
                <div class="flex flex-col">
                    <h4 class="my-8">
                        Edge X Rings
                    </h4>

                    <div class="flex flex-row space-x-4">
                        <!-- Edge X Ring Spinner s1 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-x border-dashed border-yellow-500 border-t-transparent"></div>

                        <!-- Edge X Ring Spinner s2 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-x-2 border-dashed border-blue-500 border-t-transparent"></div>

                        <!-- Edge X Ring Spinner s4 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-x-4 border-dashed border-green-500 border-t-transparent"></div>

                        <!-- Edge X Ring Spinner s8 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-x-8 border-dashed border-purple-500 border-t-transparent"></div>
                    </div>
                </div>

                <!-- Edge Y Ring Examples -->
                <div class="flex flex-col">
                    <h4 class="mb-8">
                        Edge Y Rings
                    </h4>

                    <div class="flex flex-row space-x-4">
                        <!-- Edge Y Ring Spinner s1 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-y border-dashed border-yellow-500 border-t-transparent"></div>

                        <!-- Edge Y Ring Spinner s2 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-y-2 border-dashed border-blue-500 border-t-transparent"></div>

                        <!-- Edge Y Ring Spinner s4 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-y-4 border-dashed border-green-500 border-t-transparent"></div>

                        <!-- Edge Y Ring Spinner s8 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-y-8 border-dashed border-purple-500 border-t-transparent"></div>
                    </div>
                </div>
            </div>

            <!-- Spinners With Shadow -->
            <div class="container space-y-10 relative">
                <h1 class="mb-8 text-xl font-semibold">
                    Spinners With Shadow
                </h1>

                <!-- Open Ring Examples -->
                <div class="flex flex-col">
                    <h4 class="mb-8">
                        Open Rings
                    </h4>

                    <div class="flex flex-row space-x-4">
                        <!-- Open Ring Spinner s1 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border border-solid border-yellow-500 border-t-transparent shadow-md"></div>

                        <!-- Open Ring Spinner s2 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-2 border-solid border-blue-500 border-t-transparent shadow-md"></div>

                        <!-- Open Ring Spinner s4 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-4 border-solid border-green-500 border-t-transparent shadow-md"></div>

                        <!-- Open Ring Spinner s8 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-8 border-solid border-purple-500 border-t-transparent shadow-md"></div>
                    </div>
                </div>

                <!-- Close Ring Examples -->
                <div class="flex flex-col">
                    <h4 class="mb-8">
                        Closed Rings
                    </h4>

                    <div class="flex flex-row space-x-16">
                        <!-- Closed Ring Spinner s1 -->
                        <div class="flex">
                            <div class="relative">
                                <!-- Outer Ring-->
                                <div class="w-12 h-12 rounded-full absolute
                            border border-solid border-gray-200"></div>

                                <!-- Inner Ring -->
                                <div class="w-12 h-12 rounded-full animate-spin absolute
                            border border-solid border-yellow-500 border-t-transparent shadow-md"></div>
                            </div>
                        </div>

                        <!-- Closed Ring Spinner s2 -->
                        <div class="flex">
                            <div class="relative">
                                <!-- Outer Ring-->
                                <div class="w-12 h-12 rounded-full absolute
                            border-2 border-solid border-gray-200"></div>

                                <!-- Inner Ring -->
                                <div class="w-12 h-12 rounded-full animate-spin absolute
                            border-2 border-solid border-blue-500 border-t-transparent shadow-md"></div>
                            </div>
                        </div>

                        <!-- Closed Ring Spinner s4 -->
                        <div class="flex">
                            <div class="relative">
                                <!-- Outer Ring-->
                                <div class="w-12 h-12 rounded-full absolute
                            border-4 border-solid border-gray-200"></div>

                                <!-- Inner Ring -->
                                <div class="w-12 h-12 rounded-full animate-spin absolute
                            border-4 border-solid border-green-500 border-t-transparent shadow-md"></div>
                            </div>
                        </div>

                        <!-- Closed Ring Spinner s8 -->
                        <div class="flex">
                            <div class="relative">
                                <!-- Outer Ring-->
                                <div class="w-12 h-12 rounded-full absolute
                            border-8 border-solid border-gray-200"></div>

                                <!-- Inner Ring -->
                                <div class="w-12 h-12 rounded-full animate-spin absolute
                            border-8 border-solid border-purple-500 border-t-transparent shadow-md"></div>
                            </div>
                        </div>
                    </div>

                </div>

                <!-- Edge X Ring Examples -->
                <div class="flex flex-col">
                    <h4 class="my-8">
                        Edge X Rings
                    </h4>

                    <div class="flex flex-row space-x-4">
                        <!-- Edge X Ring Spinner s1 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-x border-solid border-yellow-500 border-t-transparent shadow-md"></div>

                        <!-- Edge X Ring Spinner s2 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-x-2 border-solid border-blue-500 border-t-transparent shadow-md"></div>

                        <!-- Edge X Ring Spinner s4 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-x-4 border-solid border-green-500 border-t-transparent shadow-md"></div>

                        <!-- Edge X Ring Spinner s8 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-x-8 border-solid border-purple-500 border-t-transparent shadow-md"></div>
                    </div>
                </div>

                <!-- Edge Y Ring Examples -->
                <div class="flex flex-col">
                    <h4 class="mb-8">
                        Edge Y Rings
                    </h4>

                    <div class="flex flex-row space-x-4">
                        <!-- Edge Y Ring Spinner s1 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-y border-solid border-yellow-500 border-t-transparent shadow-md"></div>

                        <!-- Edge Y Ring Spinner s2 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-y-2 border-solid border-blue-500 border-t-transparent shadow-md"></div>

                        <!-- Edge Y Ring Spinner s4 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-y-4 border-solid border-green-500 border-t-transparent shadow-md"></div>

                        <!-- Edge Y Ring Spinner s8 -->
                        <div class="w-12 h-12 rounded-full animate-spin
                    border-y-8 border-solid border-purple-500 border-t-transparent shadow-md"></div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Notes -->
        <span class="text-center font-bold mt-40">
            <a href="https://egoistdeveloper.github.io/twcss-to-sass-playground/" target="_blank" class="text-blue-600">
                Convetert to SASS
            </a>
        </span>
    </div>
</div>

How to make a Spinner Collection with Tailwind CSS?

Install tailwind css of verion 3.0.18

Use the script html tag to import the script of Tailwind CSS of the version 3.0.18

<script src="https://cdn.tailwindcss.com"></script>

All the unility class needed to make a Spinner Collection component

  • flex
  • min-h-screen
  • bg-white
  • flex-col
  • relative
  • mb-8
  • text-xl
  • flex-row
  • w-12
  • h-12
  • border-solid
  • border-yellow-500
  • border-t-transparent
  • border-2
  • border-blue-500
  • border-4
  • border-green-500
  • border-8
  • border-purple-500
  • border-gray-200
  • my-8
  • border-x
  • border-x-2
  • border-x-4
  • border-x-8
  • border-y
  • border-y-2
  • border-y-4
  • border-y-8
  • border-dashed
  • text-center
  • mt-40
  • text-blue-600

33 steps to make a Spinner Collection component with Tailwind CSS

  1. Use flex to create a block-level flex container.

  2. Set the minimum width/height of an element using the min-h-screen utilities.

  3. Control the background color of an element to white using the bg-white utilities.

  4. Use flex to create a block-level flex container.

  5. Use relative to position an element according to the normal flow of the document.

  6. Control the margin on bottom side of an element to 2rem using the mb-8 utilities.

  7. Control the text color of an element to xl using the text-xl utilities.

  8. Use flex to create a block-level flex container.

  9. Use w-12 to set an element to a fixed width(3rem).

  10. Use h-12 to set an element to a fixed height(3rem).

  11. Control the border color of an element to solid using the border-solid utilities.

  12. Control the border color of an element to yellow-500 using the border-yellow-500 utilities.

  13. Control the border color of an element to t-transparent using the border-t-transparent utilities.

  14. Control the border color of an element to 0.5rem using the border-2 utilities.

  15. Control the border color of an element to blue-500 using the border-blue-500 utilities.

  16. Control the border color of an element to 1rem using the border-4 utilities.

  17. Control the border color of an element to green-500 using the border-green-500 utilities.

  18. Control the border color of an element to 2rem using the border-8 utilities.

  19. Control the border color of an element to purple-500 using the border-purple-500 utilities.

  20. Control the border color of an element to gray-200 using the border-gray-200 utilities.

  21. Control the vertical margin of an element to 2rem using the my-8 utilities.

  22. Control the border color of an element to x using the border-x utilities.

  23. Control the border color of an element to x-2 using the border-x-2 utilities.

  24. Control the border color of an element to x-4 using the border-x-4 utilities.

  25. Control the border color of an element to x-8 using the border-x-8 utilities.

  26. Control the border color of an element to y using the border-y utilities.

  27. Control the border color of an element to y-2 using the border-y-2 utilities.

  28. Control the border color of an element to y-4 using the border-y-4 utilities.

  29. Control the border color of an element to y-8 using the border-y-8 utilities.

  30. Control the border color of an element to dashed using the border-dashed utilities.

  31. Control the text color of an element to center using the text-center utilities.

  32. Control the margin on top side of an element to 10rem using the mt-40 utilities.

  33. Control the text color of an element to blue-600 using the text-blue-600 utilities.

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to make a Spinner Collection components, learn and follow along to implement your own components.