Published on

Ways To Build A Free Tailwind CSS Form Layout Component With Tailwind CSS In 60 Minutes

Free Tailwind CSS Form Layout Component

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 Free Tailwind CSS Form Layout Component ui component

Form tailwind components are pre-built layouts that can be easily modified to fit the needs of various use cases. find more free and premium tailwind css components at www.tailwinduikit.com

Why use Tailwind CSS to build a Free Tailwind CSS Form Layout Component ui component?

  • It can make the building process of Free Tailwind CSS Form Layout Component ui component faster and more easily.
  • Enables building complex responsive layouts and components freely.
  • Minimum lines of CSS code in Free Tailwind CSS Form Layout Component component file.

The preview of Free Tailwind CSS Form Layout Component ui component

Free download of the Free Tailwind CSS Form Layout Component's source code

The source code of Free Tailwind CSS Form Layout Component ui component

<!-- Code block starts -->
        <dh-component>
<!--- more free and premium Tailwind CSS components at https://tailwinduikit.com/ --->

            <form id="login">
                <div class="bg-white dark:bg-gray-800">
                    <div class="container mx-auto bg-white dark:bg-gray-800 rounded">
                        <div class="xl:w-full border-b border-gray-300 dark:border-gray-700 py-5 bg-white dark:bg-gray-800">
                            <div class="flex w-11/12 mx-auto xl:w-full xl:mx-0 items-center">
                                <p class="text-lg text-gray-800 dark:text-gray-100 font-bold">Profile</p>
                                <div class="ml-2 cursor-pointer text-gray-600 dark:text-gray-400">
                                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
                                        <path class="heroicon-ui" d="M12 22a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm0-9a1 1 0 0 1 1 1v4a1 1 0 0 1-2 0v-4a1 1 0 0 1 1-1zm0-4a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" fill="currentColor" />
                                    </svg>
                                </div>
                            </div>
                        </div>
                        <div class="mx-auto">
                            <div class="xl:w-9/12 w-11/12 mx-auto xl:mx-0">
                                <div class="rounded relative mt-8 h-48">
                                    <img src="https://cdn.tuk.dev/assets/webapp/forms/form_layouts/form1.jpg" alt="" class="w-full h-full object-cover rounded absolute shadow" />
                                    <div class="absolute bg-black opacity-50 top-0 right-0 bottom-0 left-0 rounded"></div>
                                    <div class="flex items-center px-3 py-2 rounded absolute right-0 mr-4 mt-4 cursor-pointer">
                                        <p class="text-xs text-gray-100">Change Cover Photo</p>
                                        <div class="ml-2 text-gray-100">
                                            <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-edit" width="18" height="18" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                                                <path stroke="none" d="M0 0h24v24H0z" />
                                                <path d="M9 7 h-3a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-3" />
                                                <path d="M9 15h3l8.5 -8.5a1.5 1.5 0 0 0 -3 -3l-8.5 8.5v3" />
                                                <line x1="16" y1="5" x2="19" y2="8" />
                                            </svg>
                                        </div>
                                    </div>
                                    <div class="w-20 h-20 rounded-full bg-cover bg-center bg-no-repeat absolute bottom-0 -mb-10 ml-12 shadow flex items-center justify-center">
                                        <img src="https://cdn.tuk.dev/assets/webapp/forms/form_layouts/form2.jpg" alt="" class="absolute z-0 h-full w-full object-cover rounded-full shadow top-0 left-0 bottom-0 right-0" />
                                        <div class="absolute bg-black opacity-50 top-0 right-0 bottom-0 left-0 rounded-full z-0"></div>
                                        <div class="cursor-pointer flex flex-col justify-center items-center z-10 text-gray-100">
                                            <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-edit" width="20" height="20" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                                                <path stroke="none" d="M0 0h24v24H0z" />
                                                <path d="M9 7 h-3a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-3" />
                                                <path d="M9 15h3l8.5 -8.5a1.5 1.5 0 0 0 -3 -3l-8.5 8.5v3" />
                                                <line x1="16" y1="5" x2="19" y2="8" />
                                            </svg>
                                            <p class="text-xs text-gray-100">Edit Picture</p>
                                        </div>
                                    </div>
                                </div>
                                <div class="mt-16 flex flex-col xl:w-2/6 lg:w-1/2 md:w-1/2 w-full">
                                    <label for="username" class="pb-2 text-sm font-bold text-gray-800 dark:text-gray-100">Username</label>
                                    <input tabindex="0" type="text" id="username" name="username" required class="border border-gray-300 dark:border-gray-700 pl-3 py-3 shadow-sm rounded text-sm focus:outline-none focus:border-indigo-700 bg-transparent placeholder-gray-500 text-gray-600 dark:text-gray-400" placeholder="@example" />
                                </div>
                                <div class="mt-8 flex flex-col xl:w-3/5 lg:w-1/2 md:w-1/2 w-full">
                                    <label for="about" class="pb-2 text-sm font-bold text-gray-800 dark:text-gray-100">About</label>
                                    <textarea id="about" name="about" required class="bg-transparent border border-gray-300 dark:border-gray-700 pl-3 py-3 shadow-sm rounded text-sm focus:outline-none focus:border-indigo-700 resize-none placeholder-gray-500 text-gray-600 dark:text-gray-400" placeholder="Let the world know who you are" rows="5"></textarea>
                                    <p class="w-full text-right text-xs pt-1 text-gray-600 dark:text-gray-400">Character Limit: 200</p>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="container mx-auto bg-white dark:bg-gray-800 mt-10 rounded px-4">
                        <div class="xl:w-full border-b border-gray-300 dark:border-gray-700 py-5">
                            <div class="flex w-11/12 mx-auto xl:w-full xl:mx-0 items-center">
                                <p class="text-lg text-gray-800 dark:text-gray-100 font-bold">Personal Information</p>
                                <div class="ml-2 cursor-pointer text-gray-600 dark:text-gray-400">
                                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
                                        <path class="heroicon-ui" d="M12 22a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm0-9a1 1 0 0 1 1 1v4a1 1 0 0 1-2 0v-4a1 1 0 0 1 1-1zm0-4a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" fill="currentColor" />
                                    </svg>
                                </div>
                            </div>
                        </div>
                        <div class="mx-auto pt-4">
                            <div class="container mx-auto">
                                <form class="my-6 w-11/12 mx-auto xl:w-full xl:mx-0">
                                    <div class="xl:w-1/4 lg:w-1/2 md:w-1/2 flex flex-col mb-6">
                                        <label for="FirstName" class="pb-2 text-sm font-bold text-gray-800 dark:text-gray-100">First Name</label>
                                        <input tabindex="0" type="text" id="FirstName" name="firstName" required class="border border-gray-300 dark:border-gray-700 pl-3 py-3 shadow-sm bg-transparent rounded text-sm focus:outline-none focus:border-indigo-700 placeholder-gray-500 text-gray-600 dark:text-gray-400" placeholder="" />
                                    </div>
                                    <div class="xl:w-1/4 lg:w-1/2 md:w-1/2 flex flex-col mb-6">
                                        <label for="LastName" class="pb-2 text-sm font-bold text-gray-800 dark:text-gray-100">Last Name</label>
                                        <input tabindex="0" type="text" id="LastName" name="lastName" required class="border border-gray-300 dark:border-gray-700 pl-3 py-3 shadow-sm bg-transparent rounded text-sm focus:outline-none focus:border-indigo-700 placeholder-gray-500 text-gray-600 dark:text-gray-400" placeholder="" />
                                    </div>
                                    <div class="xl:w-1/4 lg:w-1/2 md:w-1/2 flex flex-col mb-6">
                                        <label for="Email" class="pb-2 text-sm font-bold text-gray-800 dark:text-gray-100">Email</label>
                                        <div class="border border-green-400 shadow-sm rounded flex">
                                            <div tabindex="0" class="focus:outline-none px-4 py-3 dark:text-gray-100 flex items-center border-r border-green-400">
                                                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-mail" width="20" height="20" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                                                    <path stroke="none" d="M0 0h24v24H0z" />
                                                    <rect x="3" y="5" width="18" height="14" rx="2" />
                                                    <polyline points="3 7 12 13 21 7" />
                                                </svg>
                                            </div>
                                            <input tabindex="0" type="text" id="Email" name="email" required class="pl-3 py-3 w-full text-sm focus:outline-none placeholder-gray-500 rounded bg-transparent text-gray-600 dark:text-gray-400" placeholder="[email protected]" />
                                        </div>
                                        <div class="flex justify-between items-center pt-1 text-green-700">
                                            <p class="text-xs">Email submission success!</p>
                                            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
                                                <path
                                                    class="heroicon-ui"
                                                    d="M12 22a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm-2.3-8.7l1.3 1.29 3.3-3.3a1 1 0 0 1 1.4 1.42l-4 4a1 1 0
                                            0 1-1.4 0l-2-2a1 1 0 0 1 1.4-1.42z"
                                                    stroke="currentColor"
                                                    stroke-width="0.25"
                                                    stroke-linecap="round"
                                                    stroke-linejoin="round"
                                                    fill="currentColor"
                                                ></path>
                                            </svg>
                                        </div>
                                    </div>
                                    <div class="xl:w-1/4 lg:w-1/2 md:w-1/2 flex flex-col mb-6">
                                        <label for="StreetAddress" class="pb-2 text-sm font-bold text-gray-800 dark:text-gray-100">Street Address</label>
                                        <input tabindex="0" type="text" id="StreetAddress" name="streetAddress" required class="border border-gray-300 dark:border-gray-700 pl-3 py-3 shadow-sm rounded bg-transparent text-sm focus:outline-none focus:border-indigo-700 placeholder-gray-500 text-gray-600 dark:text-gray-400" placeholder="" />
                                    </div>
                                    <div class="xl:w-1/4 lg:w-1/2 md:w-1/2 flex flex-col mb-6">
                                        <label for="City" class="pb-2 text-sm font-bold text-gray-800 dark:text-gray-100">City</label>
                                        <div class="border border-gray-300 dark:border-gray-700 shadow-sm rounded flex">
                                            <input tabindex="0" type="text" id="City" name="city" required class="pl-3 py-3 w-full text-sm focus:outline-none border border-transparent focus:border-indigo-700 bg-transparent rounded placeholder-gray-500 text-gray-600 dark:text-gray-400" placeholder="Los Angeles" />
                                            <div class="px-4 flex items-center border-l border-gray-300 dark:border-gray-700 flex-col justify-center text-gray-600 dark:text-gray-400">
                                                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-up" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                                                    <path stroke="none" d="M0 0h24v24H0z" />
                                                    <polyline points="6 15 12 9 18 15" />
                                                </svg>
                                                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-down" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                                                    <path stroke="none" d="M0 0h24v24H0z" />
                                                    <polyline points="6 9 12 15 18 9" />
                                                </svg>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="xl:w-1/4 lg:w-1/2 md:w-1/2 flex flex-col mb-6">
                                        <label for="State/Province" class="pb-2 text-sm font-bold text-gray-800 dark:text-gray-100">State/Province</label>
                                        <input tabindex="0" type="text" id="State/Province" name="state" required class="border border-gray-300 dark:border-gray-700 pl-3 py-3 shadow-sm bg-transparent rounded text-sm focus:outline-none focus:border-indigo-700 placeholder-gray-500 text-gray-600 dark:text-gray-400" placeholder="California" />
                                    </div>
                                    <div class="xl:w-1/4 lg:w-1/2 md:w-1/2 flex flex-col mb-6">
                                        <label for="Country" class="pb-2 text-sm font-bold text-gray-800 dark:text-gray-100">Country</label>
                                        <input tabindex="0" type="text" id="Country" name="country" required class="border bg-transparent border-gray-300 dark:border-gray-700 pl-3 py-3 shadow-sm rounded text-sm focus:outline-none focus:border-indigo-700 placeholder-gray-500 text-gray-600 dark:text-gray-400" placeholder="United States" />
                                    </div>
                                    <div class="xl:w-1/4 lg:w-1/2 md:w-1/2 flex flex-col mb-6">
                                        <div class="flex items-center pb-2">
                                            <label for="ZIP" class="text-sm font-bold text-gray-800 dark:text-gray-100">ZIP/Postal Code</label>
                                            <div class="ml-2 cursor-pointer text-gray-600 dark:text-gray-400">
                                                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
                                                    <path class="heroicon-ui" d="M12 22a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm0-9a1 1 0 0 1 1 1v4a1 1 0 0 1-2 0v-4a1 1 0 0 1 1-1zm0-4a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" fill="currentColor" />
                                                </svg>
                                            </div>
                                        </div>
                                        <input tabindex="0" type="text" name="zip" required id="ZIP" class="bg-transparent border border-red-400 pl-3 py-3 shadow-sm rounded text-sm focus:outline-none focus:border-indigo-700 placeholder-gray-500 text-gray-600 dark:text-gray-400" placeholder="86745" />
                                        <div class="flex justify-between items-center pt-1 text-red-700">
                                            <p class="text-xs">Incorrect Zip Code</p>
                                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x-circle">
                                                <circle cx="12" cy="12" r="10"></circle>
                                                <line x1="15" y1="9" x2="9" y2="15"></line>
                                                <line x1="9" y1="9" x2="15" y2="15"></line>
                                            </svg>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <div class="container mx-auto mt-10 rounded bg-gray-100 dark:bg-gray-700 w-11/12 xl:w-full">
                        <div class="xl:w-full py-5 px-8">
                            <div class="flex items-center mx-auto">
                                <div class="container mx-auto">
                                    <div class="mx-auto xl:w-full">
                                        <p class="text-lg text-gray-800 dark:text-gray-100 font-bold">Alerts</p>
                                        <p class="text-sm text-gray-600 dark:text-gray-400 pt-1">Get updates of any new activity or features. Turn on/off your preferences</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="container mx-auto pb-6">
                            <div class="flex items-center pb-4 border-b border-gray-300 dark:border-gray-700 px-8 text-gray-800 dark:text-gray-100">
                                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-mail" width="20" height="20" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                                    <path stroke="none" d="M0 0h24v24H0z" />
                                    <rect x="3" y="5" width="18" height="14" rx="2" />
                                    <polyline points="3 7 12 13 21 7" />
                                </svg>
                                <p class="text-sm font-bold ml-2 text-gray-800 dark:text-gray-100">Via Email</p>
                            </div>
                            <div class="px-8">
                                <div class="flex justify-between items-center mb-8 mt-4">
                                    <div class="w-9/12">
                                        <p class="text-sm text-gray-800 dark:text-gray-100 pb-1">Comments</p>
                                        <p id="cb1" class="text-sm text-gray-600 dark:text-gray-400">Get notified when a post or comment is made</p>
                                    </div>
                                    <div class="cursor-pointer rounded-full bg-gray-200 relative shadow-sm">
                                        <input tabindex="0" aria-labelledby="cb1" type="checkbox" name="email_comments" id="toggle1" class="focus:outline-none checkbox w-6 h-6 rounded-full bg-white dark:bg-gray-400 absolute shadow-sm appearance-none cursor-pointer border border-transparent top-0 bottom-0 m-auto" />
                                        <label class="toggle-label block w-12 h-4 overflow-hidden rounded-full bg-gray-300 dark:bg-gray-800 cursor-pointer"></label>
                                    </div>
                                </div>
                                <div class="flex justify-between items-center mb-8">
                                    <div class="w-9/12">
                                        <p class="text-sm text-gray-800 dark:text-gray-100 pb-1">Job Applications</p>
                                        <p id="cb2" class="text-sm text-gray-600 dark:text-gray-400">Get notified when a candidate applies to a job posting</p>
                                    </div>
                                    <div class="cursor-pointer rounded-full bg-gray-200 relative shadow-sm">
                                        <input aria-labelledby="cb2" tabindex="0" type="checkbox" name="email_job_application" id="toggle2" class="focus:outline-none checkbox w-6 h-6 rounded-full bg-white dark:bg-gray-400 absolute shadow-sm appearance-none cursor-pointer border border-transparent top-0 bottom-0 m-auto" />
                                        <label class="toggle-label block w-12 h-4 overflow-hidden rounded-full bg-gray-300 dark:bg-gray-800 cursor-pointer"></label>
                                    </div>
                                </div>
                                <div class="flex justify-between items-center mb-8">
                                    <div class="w-9/12">
                                        <p class="text-sm text-gray-800 dark:text-gray-100 pb-1">Product Updates</p>
                                        <p id="cb3" class="text-sm text-gray-600 dark:text-gray-400">Get notifitied when there is a new product feature or upgrades</p>
                                    </div>
                                    <div class="cursor-pointer rounded-full bg-gray-200 relative shadow-sm">
                                        <input aria-labelledby="cb3" tabindex="0" type="checkbox" name="email_product_update" id="toggle3" class="focus:outline-none checkbox w-6 h-6 rounded-full bg-white dark:bg-gray-400 absolute shadow-sm appearance-none cursor-pointer border border-transparent top-0 bottom-0 m-auto" />
                                        <label class="toggle-label block w-12 h-4 overflow-hidden rounded-full bg-gray-300 dark:bg-gray-800 cursor-pointer"></label>
                                    </div>
                                </div>
                            </div>
                            <div class="pb-4 border-b border-gray-300 dark:border-gray-700 px-8">
                                <div class="flex items-center text-gray-800 dark:text-gray-100">
                                    <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-bell" width="20" height="20" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                                        <path stroke="none" d="M0 0h24v24H0z" />
                                        <path d="M10 5a2 2 0 0 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6" />
                                        <path d="M9 17v1a3 3 0 0 0 6 0v-1" />
                                    </svg>
                                    <p class="text-sm font-bold ml-2 text-gray-800 dark:text-gray-100">Push Notifications</p>
                                </div>
                            </div>
                            <div class="px-8">
                                <div class="flex justify-between items-center mb-8 mt-4">
                                    <div class="w-9/12">
                                        <p class="text-sm text-gray-800 dark:text-gray-100 pb-1">Comments</p>
                                        <p id="cb4" class="text-sm text-gray-600 dark:text-gray-400">Get notified when a post or comment is made</p>
                                    </div>
                                    <div class="cursor-pointer rounded-full bg-gray-200 relative shadow-sm">
                                        <input aria-labelledby="cb4" tabindex="0" type="checkbox" name="notification_comment" id="toggle4" class="focus:outline-none checkbox w-6 h-6 rounded-full bg-white dark:bg-gray-400 absolute shadow-sm appearance-none cursor-pointer border border-transparent top-0 bottom-0 m-auto" />
                                        <label class="toggle-label block w-12 h-4 overflow-hidden rounded-full bg-gray-300 dark:bg-gray-800 cursor-pointer"></label>
                                    </div>
                                </div>
                                <div class="flex justify-between items-center mb-8">
                                    <div class="w-9/12">
                                        <p class="text-sm text-gray-800 dark:text-gray-100 pb-1">Job Applications</p>
                                        <p id="cb5" class="text-sm text-gray-600 dark:text-gray-400">Get notified when a candidate applies to a job posting</p>
                                    </div>
                                    <div class="cursor-pointer rounded-full bg-gray-200 relative shadow-sm">
                                        <input aria-labelledby="cb5" tabindex="0" type="checkbox" name="notification_application" id="toggle5" class="focus:outline-none checkbox w-6 h-6 rounded-full bg-white dark:bg-gray-400 absolute shadow-sm appearance-none cursor-pointer border border-transparent top-0 bottom-0 m-auto" />
                                        <label class="toggle-label block w-12 h-4 overflow-hidden rounded-full bg-gray-300 dark:bg-gray-800 cursor-pointer"></label>
                                    </div>
                                </div>
                                <div class="flex justify-between items-center mb-8">
                                    <div class="w-9/12">
                                        <p class="text-sm text-gray-800 dark:text-gray-100 pb-1">Product Updates</p>
                                        <p id="cb6" class="text-sm text-gray-600 dark:text-gray-400">Get notifitied when there is a new product feature or upgrades</p>
                                    </div>
                                    <div class="cursor-pointer rounded-full bg-gray-200 relative shadow-sm">
                                        <input aria-labelledby="cb6" tabindex="0" type="checkbox" name="notification_updates" id="toggle6" class="focus:outline-none checkbox w-6 h-6 rounded-full bg-white dark:bg-gray-400 absolute shadow-sm appearance-none cursor-pointer border border-transparent top-0 bottom-0 m-auto" />
                                        <label class="toggle-label block w-12 h-4 overflow-hidden rounded-full bg-gray-300 dark:bg-gray-800 cursor-pointer"></label>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="container mx-auto w-11/12 xl:w-full">
                        <div class="w-full py-4 sm:px-0 bg-white dark:bg-gray-800 flex justify-end">
                            <button role="button" aria-label="cancel form" class="bg-gray-200 focus:outline-none transition duration-150 ease-in-out hover:bg-gray-300 dark:bg-gray-700 rounded text-indigo-600 dark:text-indigo-600 px-6 py-2 text-xs mr-4 focus:ring-2 focus:ring-offset-2 focus:ring-gray-700">Cancel</button>
                            <button role="button" aria-label="Save form" class="focus:ring-2 focus:ring-offset-2 focus:ring-indigo-700 bg-indigo-700 focus:outline-none transition duration-150 ease-in-out hover:bg-indigo-600 rounded text-white px-8 py-2 text-sm" type="submit">Save</button>
                        </div>
                    </div>
                </div>
            </form>
            <style>
                .checkbox:checked {
                    /* Apply class right-0*/
                    right: 0;
                }
                .checkbox:checked + .toggle-label {
                    /* Apply class bg-indigo-700 */
                    background-color: #4c51bf;
                }
            </style>
            <script>
                let form = document.getElementById("login");
                form.addEventListener(
                    "submit",
                    function (event) {
                        event.preventDefault();
                        let elements = form.elements;
                        let payload = {};
                        for (let i = 0; i < elements.length; i++) {
                            let item = elements.item(i);
                            switch (item.type) {
                                case "checkbox":
                                    payload[item.name] = item.checked;
                                    break;
                                case "submit":
                                    break;
                                default:
                                    payload[item.name] = item.value;
                                    break;
                            }
                        }
                        // Place your API call here to submit your payload.
                        console.log("payload", payload);
                    },
                    true
                );
            </script>
            
        </dh-component>
        <!-- Code block ends -->

How to build a Free Tailwind CSS Form Layout Component with Tailwind CSS?

Install tailwind css of verion 2.2.19

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

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

All the unility class needed to build a Free Tailwind CSS Form Layout Component component

  • bg-white
  • dark:bg-gray-800
  • mx-auto
  • xl:w-full
  • border-b
  • border-gray-300
  • dark:border-gray-700
  • py-5
  • flex
  • w-11/12
  • xl:mx-0
  • text-lg
  • text-gray-800
  • dark:text-gray-100
  • ml-2
  • text-gray-600
  • dark:text-gray-400
  • xl:w-9/12
  • relative
  • mt-8
  • h-48
  • w-full
  • h-full
  • absolute
  • bg-black
  • top-0
  • right-0
  • bottom-0
  • left-0
  • px-3
  • py-2
  • mr-4
  • mt-4
  • text-xs
  • text-gray-100
  • w-20
  • h-20
  • bg-cover
  • bg-center
  • bg-no-repeat
  • -mb-10
  • ml-12
  • z-0
  • flex-col
  • z-10
  • mt-16
  • xl:w-2/6
  • lg:w-1/2
  • md:w-1/2
  • pb-2
  • text-sm
  • pl-3
  • py-3
  • focus:border-indigo-700
  • bg-transparent
  • xl:w-3/5
  • text-right
  • pt-1
  • mt-10
  • px-4
  • pt-4
  • my-6
  • xl:w-1/4
  • mb-6
  • border-green-400
  • border-r
  • text-green-700
  • border-transparent
  • border-l
  • border-red-400
  • text-red-700
  • bg-gray-100
  • dark:bg-gray-700
  • px-8
  • pb-6
  • pb-4
  • mb-8
  • w-9/12
  • pb-1
  • bg-gray-200
  • w-6
  • h-6
  • dark:bg-gray-400
  • m-auto
  • block
  • w-12
  • h-4
  • overflow-hidden
  • bg-gray-300
  • py-4
  • sm:px-0
  • hover:bg-gray-300
  • text-indigo-600
  • dark:text-indigo-600
  • px-6
  • bg-indigo-700
  • hover:bg-indigo-600
  • text-white

98 steps to build a Free Tailwind CSS Form Layout Component component with Tailwind CSS

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

  2. Control the background color of an element to gray-800 using the dark:bg-gray-800 utilities in dark theme.

  3. Control the horizontal margin of an element to auto using the mx-auto utilities.

  4. Use w-full to set an element to a 100% based width at only extremely large screen sizes.

  5. Control the border color of an element to b using the border-b utilities.

  6. Control the border color of an element to gray-300 using the border-gray-300 utilities.

  7. Control the border color of an element to gray-700 using the dark:border-gray-700 utilities in dark theme.

  8. Control the vertical padding of an element to 1.25rem using the py-5 utilities.

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

  10. Use w-11/12 to set an element to a fixed width(11/12).

  11. Control the horizontal margin of an element to 0rem at only extremely large screen sizes using the xl:mx-0 utilities.

  12. Control the text color of an element to lg using the text-lg utilities.

  13. Control the text color of an element to gray-800 using the text-gray-800 utilities.

  14. Control the text color of an element to gray-100 in dark theme using the dark:text-gray-100 utilities.

  15. Control the margin on left side of an element to 0.5rem using the ml-2 utilities.

  16. Control the text color of an element to gray-600 using the text-gray-600 utilities.

  17. Control the text color of an element to gray-400 in dark theme using the dark:text-gray-400 utilities.

  18. Use xl:w-9/12 to set an element to a fixed width(9/12) at only extremely large screen sizes.

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

  20. Control the margin on top side of an element to 2rem using the mt-8 utilities.

  21. Use h-48 to set an element to a fixed height(12rem).

  22. Use w-full to set an element to a 100% based width.

  23. Use h-full to set an element’s height to 100% of its parent, as long as the parent has a defined height.

  24. Use absolute to position an element outside of the normal flow of the document, causing neighboring elements to act as if the element doesn’t exist.

  25. Control the background color of an element to black using the bg-black utilities.

  26. Use the top-0 utilities to set the top position of a positioned element to 0rem.

  27. Use the right-0 utilities to set the right position of a positioned element to 0rem.

  28. Use the bottom-0 utilities to set the bottom position of a positioned element to 0rem.

  29. Use the left-0 utilities to set the left position of a positioned element to 0rem.

  30. Control the horizontal padding of an element to 0.75rem using the px-3 utilities.

  31. Control the vertical padding of an element to 0.5rem using the py-2 utilities.

  32. Control the margin on right side of an element to 1rem using the mr-4 utilities.

  33. Control the margin on top side of an element to 1rem using the mt-4 utilities.

  34. Control the text color of an element to xs using the text-xs utilities.

  35. Control the text color of an element to gray-100 using the text-gray-100 utilities.

  36. Use w-20 to set an element to a fixed width(5rem).

  37. Use h-20 to set an element to a fixed height(5rem).

  38. Control the background color of an element to cover using the bg-cover utilities.

  39. Control the background color of an element to center using the bg-center utilities.

  40. Control the background color of an element to no-repeat using the bg-no-repeat utilities.

  41. Control the margin on bottom side of an element to -2.5rem using the -mb-10 utilities.

  42. Control the margin on left side of an element to 3rem using the ml-12 utilities.

  43. Control the stack order (or three-dimensional positioning) of an element to 0 in Tailwind, regardless of order it has been displayed, using the z-0 utilities.

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

  45. Control the stack order (or three-dimensional positioning) of an element to 10 in Tailwind, regardless of order it has been displayed, using the z-10 utilities.

  46. Control the margin on top side of an element to 4rem using the mt-16 utilities.

  47. Use xl:w-2/6 to set an element to a fixed width(2/6) at only extremely large screen sizes.

  48. Use lg:w-1/2 to set an element to a fixed width(1/2) at only large screen sizes.

  49. Use md:w-1/2 to set an element to a fixed width(1/2) at only medium screen sizes.

  50. Control the padding on bottom side of an element to 0.5rem using the pb-2 utilities.

  51. Control the text color of an element to sm using the text-sm utilities.

  52. Adjust the left padding of an element to 0.75rem using the pl-3 utilities class

  53. Control the vertical padding of an element to 0.75rem using the py-3 utilities.

  54. Control the border color of an element to indigo-700 using the focus:border-indigo-700 utilities on focus.

  55. Control the background color of an element to transparent using the bg-transparent utilities.

  56. Use xl:w-3/5 to set an element to a fixed width(3/5) at only extremely large screen sizes.

  57. Control the text color of an element to right using the text-right utilities.

  58. Control the padding on top side of an element to 0.25rem using the pt-1 utilities.

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

  60. Control the horizontal padding of an element to 1rem using the px-4 utilities.

  61. Control the padding on top side of an element to 1rem using the pt-4 utilities.

  62. Control the vertical margin of an element to 1.5rem using the my-6 utilities.

  63. Use xl:w-1/4 to set an element to a fixed width(1/4) at only extremely large screen sizes.

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

  65. Control the border color of an element to green-400 using the border-green-400 utilities.

  66. Control the border color of an element to r using the border-r utilities.

  67. Control the text color of an element to green-700 using the text-green-700 utilities.

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

  69. Control the border color of an element to l using the border-l utilities.

  70. Control the border color of an element to red-400 using the border-red-400 utilities.

  71. Control the text color of an element to red-700 using the text-red-700 utilities.

  72. Control the background color of an element to gray-100 using the bg-gray-100 utilities.

  73. Control the background color of an element to gray-700 using the dark:bg-gray-700 utilities in dark theme.

  74. Control the horizontal padding of an element to 2rem using the px-8 utilities.

  75. Control the padding on bottom side of an element to 1.5rem using the pb-6 utilities.

  76. Control the padding on bottom side of an element to 1rem using the pb-4 utilities.

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

  78. Use w-9/12 to set an element to a fixed width(9/12).

  79. Control the padding on bottom side of an element to 0.25rem using the pb-1 utilities.

  80. Control the background color of an element to gray-200 using the bg-gray-200 utilities.

  81. Use w-6 to set an element to a fixed width(1.5rem).

  82. Use h-6 to set an element to a fixed height(1.5rem).

  83. Control the background color of an element to gray-400 using the dark:bg-gray-400 utilities in dark theme.

  84. Control the margin on all sides of an element to auto using the m-auto utilities.

  85. Use inline utilities to put the element on its own line and fill its parent.

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

  87. Use h-4 to set an element to a fixed height(1rem).

  88. Use overflow-hidden to clip any content within an element that overflows the bounds of that element.

  89. Control the background color of an element to gray-300 using the bg-gray-300 utilities.

  90. Control the vertical padding of an element to 1rem using the py-4 utilities.

  91. Control the horizontal padding of an element to 0rem at only small screen sizes using the sm:px-0 utilities.

  92. Control the background color of an element to gray-300 using the hover:bg-gray-300 utilities on hover.

  93. Control the text color of an element to indigo-600 using the text-indigo-600 utilities.

  94. Control the text color of an element to indigo-600 in dark theme using the dark:text-indigo-600 utilities.

  95. Control the horizontal padding of an element to 1.5rem using the px-6 utilities.

  96. Control the background color of an element to indigo-700 using the bg-indigo-700 utilities.

  97. Control the background color of an element to indigo-600 using the hover:bg-indigo-600 utilities on hover.

  98. Control the text color of an element to white using the text-white utilities.

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to build a Free Tailwind CSS Form Layout Component components, learn and follow along to implement your own components.