浏览所有可用的 Tailwind CSS 组件
一个具有玻璃态风格的响应式页脚组件,配备有磨砂玻璃状的透明元素和模糊效果,支持暗黑主题。
<footer class="bg-white bg-opacity-30 backdrop-blur-md rounded-lg p-6 dark:bg-gray-800 dark:bg-opacity-30 transition duration-300 ease-in-out"> <div class="container mx-auto"> <div class="flex flex-col md:flex-row justify-between items-center"> <div class="text-center md:text-left"> <h2 class="text-xl font-bold text-gray-800 dark:text-white">Connect with Us</h2> <p class="text-gray-600 dark:text-gray-300">Stay updated with our latest news and offers.</p> </div> <div class="mt-4 md:mt-0"> <a href="#" class="text-gray-500 hover:text-gray-800 dark:hover:text-white mx-2"><img src="https://picsum.photos/40/40?random=1" alt="Avatar" class="rounded-full " /></a> <a href="#" class="text-gray-500 hover:text-gray-800 dark:hover:text-white mx-2"><img src="https://picsum.photos/40/40?random=2" alt="Avatar" class="rounded-full " /></a> <a href="#" class="text-gray-500 hover:text-gray-800 dark:hover:text-white mx-2"><img src="https://picsum.photos/40/40?random=3" alt="Avatar" class="rounded-full " /></a> </div> </div> <div class="flex justify-center mt-4"> <a href="#" class="text-gray-500 hover:text-gray-800 dark:hover:text-white mx-2">Privacy Policy</a> <span class="text-gray-500 dark:text-gray-300">|</span> <a href="#" class="text-gray-500 hover:text-gray-800 dark:hover:text-white mx-2">Terms of Service</a> </div> </div> </footer>
一个反馈组件,具有评分刻度和评论文本区域,采用响应式设计,支持暗黑主题。
<div class="container mx-auto p-4 md:p-8 bg-gray-100 dark:bg-gray-800 shadow-lg rounded-lg"> <h2 class="text-2xl font-bold text-gray-800 dark:text-white mb-4">Leave Feedback</h2> <div class="mb-4"> <label class="block text-gray-700 dark:text-gray-300 text-sm font-bold mb-2" for="rating"> Overall Rating </label> <div class="flex items-center"> <input type="radio" name="rating" id="rating-5" class="hidden" value="5" /> <label for="rating-5" class="text-3xl text-gray-400 dark:text-gray-600 cursor-pointer select-none hover:text-yellow-500 dark:hover:text-yellow-500 transition-colors duration-200">★</label> <input type="radio" name="rating" id="rating-4" class="hidden" value="4" /> <label for="rating-4" class="text-3xl text-gray-400 dark:text-gray-600 cursor-pointer select-none hover:text-yellow-500 dark:hover:text-yellow-500 transition-colors duration-200">★</label> <input type="radio" name="rating" id="rating-3" class="hidden" value="3" /> <label for="rating-3" class="text-3xl text-gray-400 dark:text-gray-600 cursor-pointer select-none hover:text-yellow-500 dark:hover:text-yellow-500 transition-colors duration-200">★</label> <input type="radio" name="rating" id="rating-2" class="hidden" value="2" /> <label for="rating-2" class="text-3xl text-gray-400 dark:text-gray-600 cursor-pointer select-none hover:text-yellow-500 dark:hover:text-yellow-500 transition-colors duration-200">★</label> <input type="radio" name="rating" id="rating-1" class="hidden" value="1" /> <label for="rating-1" class="text-3xl text-gray-400 dark:text-gray-600 cursor-pointer select-none hover:text-yellow-500 dark:hover:text-yellow-500 transition-colors duration-200">★</label> </div> </div> <div class="mb-4"> <label class="block text-gray-700 dark:text-gray-300 text-sm font-bold mb-2" for="comment"> Your Feedback </label> <textarea id="comment" name="comment" rows="4" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 dark:text-gray-200 leading-tight focus:outline-none focus:shadow-outline bg-white dark:bg-gray-700 dark:border-gray-600" placeholder="Tell us about your experience..."></textarea> </div> <div class="flex items-center justify-between"> <button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline dark:bg-blue-700 dark:hover:bg-blue-900" type="button"> Submit Feedback </button> </div> </div>
一个极简主义的过滤器组件,采用响应式设计,使用 Tailwind CSS,支持暗黑主题。
<div class="bg-white dark:bg-gray-800 shadow-md rounded-lg p-4"> <h3 class="text-lg font-semibold text-gray-800 dark:text-white mb-4">Filters</h3> <div class="flex flex-col space-y-2"> <div class="flex items-center justify-between"> <label for="category" class="text-gray-700 dark:text-gray-300">Category:</label> <select id="category" class="border border-gray-300 dark:border-gray-600 rounded-md px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200"> <option value="all">All</option> <option value="electronics">Electronics</option> <option value="books">Books</option> <option value="clothing">Clothing</option> </select> </div> <div class="flex items-center justify-between"> <label for="price" class="text-gray-700 dark:text-gray-300">Max Price:</label> <input type="range" id="price" min="0" max="1000" value="1000" class="w-full ml-4"> </div> <div class="flex items-center justify-between"> <label for="sort" class="text-gray-700 dark:text-gray-300">Sort By:</label> <select id="sort" class="border border-gray-300 dark:border-gray-600 rounded-md px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200"> <option value="newest">Newest</option> <option value="price-low-high">Price: Low to High</option> <option value="price-high-low">Price: High to Low</option> </select> </div> </div> <button class="mt-6 w-full bg-blue-500 text-white py-2 px-4 rounded-md hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50 dark:bg-blue-700 dark:hover:bg-blue-800 dark:focus:ring-blue-700">Apply Filters</button> </div>
一个极简主义的响应式注册表单组件,采用 Tailwind CSS 设计,支持暗模式,具有干净的空间和最小的元素。
<div class="min-h-screen bg-gray-100 dark:bg-gray-900 flex items-center justify-center"> <div class="bg-white dark:bg-gray-800 shadow-md rounded-lg p-6 max-w-md w-full"> <h2 class="text-xl font-semibold text-gray-800 dark:text-gray-200 text-center">Create Account</h2> <form class="mt-6 space-y-4"> <div> <label class="block text-gray-700 dark:text-gray-300 mb-1" for="name">Name</label> <input type="text" id="name" name="name" class="w-full bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md p-2 text-gray-800 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-300" required placeholder="Your Name"> </div> <div> <label class="block text-gray-700 dark:text-gray-300 mb-1" for="email">Email</label> <input type="email" id="email" name="email" class="w-full bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md p-2 text-gray-800 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-300" required placeholder="[email protected]"> </div> <div> <label class="block text-gray-700 dark:text-gray-300 mb-1" for="password">Password</label> <input type="password" id="password" name="password" class="w-full bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md p-2 text-gray-800 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-300" required placeholder="••••••••"> </div> <div> <label class="block text-gray-700 dark:text-gray-300 mb-1" for="avatar">Avatar</label> <div class="flex items-center space-x-4"> <img src="https://randomuser.me/api/portraits/men/1.jpg" alt="Avatar" class="w-16 h-16 rounded-full border border-gray-300 dark:border-gray-600"> <input type="file" id="avatar" name="avatar" class="bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md p-2 text-gray-800 dark:text-gray-200"> </div> </div> <div class="mt-6"> <button type="submit" class="w-full py-2 px-4 bg-blue-600 dark:bg-blue-500 text-white font-semibold rounded-md hover:bg-blue-700 dark:hover:bg-blue-400 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400">Register</button> </div> </form> <p class="mt-4 text-center text-gray-600 dark:text-gray-400"> Already have an account? <a href="#" class="text-blue-600 dark:text-blue-400 hover:underline">Login</a> </p> </div> </div>
一个采用野兽派风格、使用 Tailwind CSS 设计的响应式错误消息组件,具有高对比、独特布局和暗模式支持。
<div class="bg-white dark:bg-gray-800 border-2 border-red-600 dark:border-red-400 rounded-lg p-6 max-w-md mx-auto mt-10 shadow-lg"> <div class="flex items-center mb-4"> <img class="w-16 h-16 rounded-full border-2 border-red-600 dark:border-red-400 mr-4" src="https://randomuser.me/api/portraits/men/1.jpg" alt="Error Avatar"> <h2 class="text-red-600 dark:text-red-400 font-bold text-xl">Error Title</h2> </div> <p class="text-gray-800 dark:text-gray-200 mb-3"> This is a sample error message that describes the issue encountered. It is intentionally raw and bold to reflect the brutalism design style. </p> <img class="w-full rounded-md mb-4" src="https://picsum.photos/400/200?random=1" alt="Random placeholder image"> <div class="flex justify-between items-center"> <button class="bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-4 rounded transition duration-150 ease-in-out">Dismiss</button> <span class="text-gray-500 dark:text-gray-400 text-sm">Timestamp: 20:15</span> </div> </div> <div class="bg-white dark:bg-gray-800 border-2 border-yellow-600 dark:border-yellow-400 rounded-lg p-6 max-w-md mx-auto mt-5 shadow-lg"> <div class="flex items-center mb-4"> <img class="w-16 h-16 rounded-full border-2 border-yellow-600 dark:border-yellow-400 mr-4" src="https://randomuser.me/api/portraits/men/2.jpg" alt="Warning Avatar"> <h2 class="text-yellow-600 dark:text-yellow-400 font-bold text-xl">Warning Title</h2> </div> <p class="text-gray-800 dark:text-gray-200 mb-3"> This is a warning message that might help you avoid a potential issue. It’s meant to catch your attention with a bold approach. </p> <img class="w-full rounded-md mb-4" src="https://picsum.photos/400/200?random=2" alt="Random placeholder image"> <div class="flex justify-between items-center"> <button class="bg-yellow-500 hover:bg-yellow-600 text-white font-bold py-2 px-4 rounded transition duration-150 ease-in-out">Acknowledge</button> <span class="text-gray-500 dark:text-gray-400 text-sm">Timestamp: 20:15</span> </div> </div>
一个具有玻璃态设计的响应式头部组件,配备有磨砂玻璃状的透明元素和暗黑主题支持。
<header class="bg-white bg-opacity-30 backdrop-blur-lg dark:bg-gray-800 dark:bg-opacity-60 shadow-lg p-4 flex justify-between items-center"> <div class="flex items-center"> <img src="https://picsum.photos/50/50" alt="Logo" class="rounded-full mr-2"> <h1 class="text-xl font-bold text-gray-900 dark:text-white">My Website</h1> </div> <nav class="space-x-4"> <a href="#" class="text-gray-800 dark:text-gray-200 hover:underline">Home</a> <a href="#" class="text-gray-800 dark:text-gray-200 hover:underline">About</a> <a href="#" class="text-gray-800 dark:text-gray-200 hover:underline">Services</a> <a href="#" class="text-gray-800 dark:text-gray-200 hover:underline">Contact</a> </nav> <div class="flex items-center"> <img src="https://randomuser.me/api/portraits/men/1.jpg" alt="User Avatar" class="rounded-full w-10 h-10"> </div> </header>
一个采用材料设计原则、使用 Tailwind CSS 样式的响应式添加到购物车按钮,支持暗模式主题。
<div class="flex items-center justify-center h-screen bg-gray-100 dark:bg-gray-800 transition-colors duration-300"> <div class="bg-white dark:bg-gray-900 shadow-lg rounded-lg px-5 py-4 transition-transform duration-300 hover:scale-105"> <img src="https://picsum.photos/200/200" alt="Product Image" class="w-full h-40 object-cover rounded-md mb-4"> <h2 class="text-lg font-semibold dark:text-white">Product Name</h2> <p class="text-gray-700 dark:text-gray-300 mb-4">This is a brief description of the product.</p> <div class="flex items-center justify-between"> <span class="text-xl font-bold dark:text-white">$19.99</span> <button class="bg-blue-600 text-white rounded-md px-4 py-2 transition-colors duration-300 hover:bg-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50 dark:bg-blue-700 dark:hover:bg-blue-600"> Add to Cart </button> </div> </div> </div>
一个具有响应效果和暗黑主题支持的拟物化添加到购物车按钮。
<button class="bg-gradient-to-b from-gray-200 to-gray-300 dark:from-gray-700 dark:to-gray-800 text-gray-800 dark:text-gray-200 py-3 px-6 rounded-lg shadow-md hover:shadow-lg transition duration-300 ease-in-out" > <span class="flex items-center justify-center"> <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor" > <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z" ></path> </svg> Add to Cart </span> </button>
一个采用材料设计原则、使用 Tailwind CSS 设计的网站地图组件,具有响应式布局、动画和暗黑主题支持。
<div class="bg-white dark:bg-gray-800 p-8 rounded-lg shadow-lg"> <h2 class="text-2xl font-bold mb-6 text-gray-800 dark:text-white">Site Map</h2> <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> <div class="bg-gray-100 dark:bg-gray-700 p-4 rounded-lg shadow"> <h3 class="font-semibold text-lg text-gray-700 dark:text-gray-200">Section 1</h3> <ul class="mt-2"> <li><a href="#" class="text-blue-600 dark:text-blue-400 hover:underline">Home</a></li> <li><a href="#" class="text-blue-600 dark:text-blue-400 hover:underline">About Us</a></li> <li><a href="#" class="text-blue-600 dark:text-blue-400 hover:underline">Services</a></li> <li><a href="#" class="text-blue-600 dark:text-blue-400 hover:underline">Contact</a></li> </ul> </div> <div class="bg-gray-100 dark:bg-gray-700 p-4 rounded-lg shadow"> <h3 class="font-semibold text-lg text-gray-700 dark:text-gray-200">Section 2</h3> <ul class="mt-2"> <li><a href="#" class="text-blue-600 dark:text-blue-400 hover:underline">Blog</a></li> <li><a href="#" class="text-blue-600 dark:text-blue-400 hover:underline">Pricing</a></li> <li><a href="#" class="text-blue-600 dark:text-blue-400 hover:underline">Testimonials</a></li> </ul> </div> <div class="bg-gray-100 dark:bg-gray-700 p-4 rounded-lg shadow"> <h3 class="font-semibold text-lg text-gray-700 dark:text-gray-200">Section 3</h3> <ul class="mt-2"> <li><a href="#" class="text-blue-600 dark:text-blue-400 hover:underline">FAQs</a></li> <li><a href="#" class="text-blue-600 dark:text-blue-400 hover:underline">Support</a></li> <li><a href="#" class="text-blue-600 dark:text-blue-400 hover:underline">Privacy Policy</a></li> </ul> </div> </div> <div class="mt-8"> <h3 class="font-semibold text-lg text-gray-700 dark:text-gray-200">Team</h3> <div class="flex space-x-4 mt-2"> <div class="bg-gray-100 dark:bg-gray-700 rounded-full p-2 w-16 h-16 flex justify-center items-center shadow"> <img src="https://picsum.photos/seed/pic1/100/100" alt="Avatar" class="rounded-full"> </div> <div class="bg-gray-100 dark:bg-gray-700 rounded-full p-2 w-16 h-16 flex justify-center items-center shadow"> <img src="https://picsum.photos/seed/pic2/100/100" alt="Avatar" class="rounded-full"> </div> <div class="bg-gray-100 dark:bg-gray-700 rounded-full p-2 w-16 h-16 flex justify-center items-center shadow"> <img src="https://picsum.photos/seed/pic3/100/100" alt="Avatar" class="rounded-full"> </div> </div> </div></div>
一个采用受 80 年代和 90 年代启发的复古/古董美学设计的响应式数据可视化组件,支持深色主题,并使用占位图像。
<div class="bg-gray-800 text-white p-6 rounded-lg shadow-lg max-w-md mx-auto"> <h2 class="text-2xl font-bold mb-4 text-center">Data Visualization</h2> <div class="mb-4"> <h3 class="text-lg font-semibold mb-2">User Statistics</h3> <div class="overflow-hidden rounded-lg"> <img class="w-full h-32 object-cover" src="https://picsum.photos/id/237/400/200" alt="Data Visualization Image"> </div> <p class="mt-2 text-sm">This chart represents the users joining over the past year.</p> </div> <div class="font-mono mb-6"> <p class="text-sm">Last updated: <span class="font-bold">2 days ago</span></p> </div> <div class="bg-gray-700 p-4 text-center rounded-lg"> <h3 class="text-lg font-semibold">Profile Overview</h3> <div class="flex justify-around mt-4"> <div class="flex flex-col items-center"> <img class="w-12 h-12 rounded-full" src="https://randomuser.me/api/portraits/men/1.jpg" alt="User Avatar"> <span class="mt-2 text-sm">User 1</span> </div> <div class="flex flex-col items-center"> <img class="w-12 h-12 rounded-full" src="https://randomuser.me/api/portraits/women/1.jpg" alt="User Avatar"> <span class="mt-2 text-sm">User 2</span> </div> </div> </div> <style> @media (prefers-color-scheme: dark) { .bg-gray-800 { background-color: #1f2937; } .bg-gray-700 { background-color: #374151; } } </style> </div>