浏览所有可用的 Tailwind CSS 组件
一个具有3D设计风格的响应式导航栏,融入深度和参与感,支持暗主题。
<nav class="bg-white dark:bg-gray-900 shadow-lg rounded-lg p-6"> <div class="flex justify-between items-center"> <div class="flex items-center"> <img src="https://picsum.photos/40" alt="Logo" class="rounded-full mr-3 shadow-md"> <h1 class="text-xl font-bold text-gray-800 dark:text-gray-100">My Website</h1> </div> <div class="hidden md:flex space-x-6"> <a href="#" class="text-gray-800 dark:text-gray-100 hover:text-blue-500 dark:hover:text-blue-400 transition duration-200">Home</a> <a href="#" class="text-gray-800 dark:text-gray-100 hover:text-blue-500 dark:hover:text-blue-400 transition duration-200">About</a> <a href="#" class="text-gray-800 dark:text-gray-100 hover:text-blue-500 dark:hover:text-blue-400 transition duration-200">Services</a> <a href="#" class="text-gray-800 dark:text-gray-100 hover:text-blue-500 dark:hover:text-blue-400 transition duration-200">Contact</a> </div> <div class="md:hidden"> <button class="text-gray-800 dark:text-gray-100 hover:text-blue-500 dark:hover:text-blue-400 transition duration-200"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M3 6h14M3 10h14m-7 4h7" clip-rule="evenodd" /></svg> </button> </div> </div> <div class="mt-4 md:hidden space-x-4"> <a href="#" class="block text-gray-800 dark:text-gray-100 hover:text-blue-500 dark:hover:text-blue-400 transition duration-200">Home</a> <a href="#" class="block text-gray-800 dark:text-gray-100 hover:text-blue-500 dark:hover:text-blue-400 transition duration-200">About</a> <a href="#" class="block text-gray-800 dark:text-gray-100 hover:text-blue-500 dark:hover:text-blue-400 transition duration-200">Services</a> <a href="#" class="block text-gray-800 dark:text-gray-100 hover:text-blue-500 dark:hover:text-blue-400 transition duration-200">Contact</a> </div> </nav>
一个复古/老式的“添加到购物车”按钮组件,使用Tailwind CSS设计,具有响应式设计和支持暗主题。
<div class="flex flex-col items-center justify-center p-8 bg-white dark:bg-gray-800 rounded-lg shadow-lg"> <img src="https://picsum.photos/200/100?random=1" alt="Product Image" class="w-full h-auto rounded-md mb-4"> <h2 class="text-2xl font-bold text-gray-800 dark:text-white mb-2">Retro Product Name</h2> <p class="text-gray-600 dark:text-gray-300 mb-4">This is a brief description of the retro product.</p> <div class="flex items-center space-x-2"> <img src="https://randomuser.me/api/portraits/men/1.jpg" alt="User Avatar" class="w-10 h-10 rounded-full border-2 border-gray-300 dark:border-gray-600"> <button class="px-4 py-2 font-semibold text-white bg-blue-600 rounded-lg shadow hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-400 dark:bg-blue-700 dark:hover:bg-blue-800 dark:focus:ring-blue-600">Add to Cart</button> </div> </div>
一个复古/老式风格的错误消息组件,具有响应式效果和支持暗主题,使用Tailwind CSS。
<div class="max-w-md mx-auto bg-white dark:bg-gray-800 rounded-lg border border-gray-300 dark:border-gray-700 p-6 mt-5 shadow-lg"> <div class="flex items-center space-x-3"> <img class="w-12 h-12 rounded-full" src="https://randomuser.me/api/portraits/men/41.jpg" alt="User Avatar"> <div class="flex-1"> <h2 class="text-lg font-bold text-gray-800 dark:text-gray-200">Error Title</h2> <p class="text-sm text-gray-600 dark:text-gray-400">This is a descriptive message about the error that occurred. Please take the necessary action to fix it. Thank you.</p> </div> </div> <div class="mt-4 flex space-x-4"> <button class="bg-blue-500 text-white font-semibold py-2 px-4 rounded-lg hover:bg-blue-600 dark:bg-blue-700 dark:hover:bg-blue-600 transition duration-200">Retry</button> <button class="bg-red-500 text-white font-semibold py-2 px-4 rounded-lg hover:bg-red-600 dark:bg-red-700 dark:hover:bg-red-600 transition duration-200">Cancel</button> </div> <div class="mt-4"> <img class="rounded-lg" src="https://picsum.photos/300/200?random=1" alt="Error Illustration"> </div> </div>
一个设计有迷你交互的360°查看器组件,采用响应式效果和支持暗主题的Tailwind CSS。
<div class="relative w-full h-96 overflow-hidden bg-gray-200 dark:bg-gray-800 rounded-lg shadow-lg"> <div class="absolute inset-0 flex items-center justify-center"> <img src="https://picsum.photos/400/300" alt="360 View" class="transition-transform duration-300 transform hover:scale-110" /> </div> <div class="absolute inset-0 flex items-center justify-center"> <img src="https://picsum.photos/400/300?blur" alt="360 View" class="transition-opacity duration-300 opacity-0 hover:opacity-100" /> </div> <div class="absolute inset-0 flex items-center justify-center"> <button class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition duration-300"> Rotate </button> </div> </div> <div class="mt-4 text-center"> <h2 class="text-xl font-semibold dark:text-white">Explore Our 360° View</h2> <p class="text-gray-600 dark:text-gray-400">Hover over the image to see the effect!</p> </div>
一个遵循拟物设计原则的响应式导航组件,具有模拟真实世界对应物的数字元素,支持暗主题。
<nav class="bg-gray-200 dark:bg-gray-800 rounded-lg shadow-lg p-4"> <div class="flex justify-between items-center"> <a href="#" class="flex items-center"> <img src="https://picsum.photos/40" alt="Logo" class="rounded-full mr-2"> <span class="text-lg font-bold text-gray-800 dark:text-gray-200">MyApp</span> </a> <div class="hidden md:flex space-x-4"> <a href="#" class="text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-white transition duration-300">Home</a> <a href="#" class="text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-white transition duration-300">About</a> <a href="#" class="text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-white transition duration-300">Services</a> <a href="#" class="text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-white transition duration-300">Contact</a> </div> <div class="md:hidden flex items-center"> <button class="text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-white transition duration-300"> <img src="https://randomuser.me/api/portraits/thumb/men/1.jpg" alt="User Avatar" class="rounded-full w-10 h-10"> </button> </div> </div> <div class="mt-2 md:hidden"> <a href="#" class="block text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-white transition duration-300">Home</a> <a href="#" class="block text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-white transition duration-300">About</a> <a href="#" class="block text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-white transition duration-300">Services</a> <a href="#" class="block text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-white transition duration-300">Contact</a> </div> </nav>
一个使用Tailwind CSS设计的响应式热图组件,采用新拟态风格,支持暗模式,并具有随机图像和头像。
<div class="flex flex-col items-center justify-center min-h-screen bg-gradient-to-r from-gray-200 to-gray-300 dark:from-gray-800 dark:to-gray-900 px-4"> <h2 class="text-2xl font-semibold mb-4 text-gray-700 dark:text-gray-300">Heat Map Component</h2> <div class="grid grid-cols-1 md:grid-cols-3 gap-4 w-full max-w-4xl"> <!-- Sample Heat Map Item --> <div class="flex flex-col items-center justify-center p-4 rounded-lg shadow-lg bg-white dark:bg-gray-700 transition-all duration-300 ease-in-out hover:shadow-xl"> <img class="w-24 h-24 rounded-full mb-2" src="https://picsum.photos/200/200?random=1" alt="Random Image" /> <p class="text-lg font-medium text-gray-800 dark:text-gray-300">Heat Point 1</p> <p class="text-sm text-gray-500 dark:text-gray-400">Activity Level: High</p> </div> <div class="flex flex-col items-center justify-center p-4 rounded-lg shadow-lg bg-white dark:bg-gray-700 transition-all duration-300 ease-in-out hover:shadow-xl"> <img class="w-24 h-24 rounded-full mb-2" src="https://picsum.photos/200/200?random=2" alt="Random Image" /> <p class="text-lg font-medium text-gray-800 dark:text-gray-300">Heat Point 2</p> <p class="text-sm text-gray-500 dark:text-gray-400">Activity Level: Medium</p> </div> <div class="flex flex-col items-center justify-center p-4 rounded-lg shadow-lg bg-white dark:bg-gray-700 transition-all duration-300 ease-in-out hover:shadow-xl"> <img class="w-24 h-24 rounded-full mb-2" src="https://picsum.photos/200/200?random=3" alt="Random Image" /> <p class="text-lg font-medium text-gray-800 dark:text-gray-300">Heat Point 3</p> <p class="text-sm text-gray-500 dark:text-gray-400">Activity Level: Low</p> </div> <!-- More heat map items can be added here --> </div> </div>
一个具有3D设计风格的响应式活动反馈组件,融入深度效果和支持暗主题,使用Tailwind CSS构建。
<div class="max-w-4xl mx-auto p-6 bg-white dark:bg-gray-800 shadow-lg rounded-lg transform hover:scale-105 transition-transform duration-200 ease-in-out"> <h2 class="text-xl font-semibold text-gray-900 dark:text-white mb-4">Activity Feed</h2> <div class="flex items-center space-x-4 mb-6"> <img src="https://randomuser.me/api/portraits/men/1.jpg" alt="User Avatar" class="w-12 h-12 rounded-full shadow-md"> <div class="flex-1"> <p class="text-gray-700 dark:text-gray-300 font-medium">John Doe</p> <p class="text-gray-500 dark:text-gray-400 text-sm">Just created a new project!</p> <p class="text-gray-400 dark:text-gray-500 text-xs">2 minutes ago</p> </div> </div> <div class="flex items-center space-x-4 mb-6"> <img src="https://randomuser.me/api/portraits/women/2.jpg" alt="User Avatar" class="w-12 h-12 rounded-full shadow-md"> <div class="flex-1"> <p class="text-gray-700 dark:text-gray-300 font-medium">Jane Smith</p> <p class="text-gray-500 dark:text-gray-400 text-sm">Liked your post.</p> <p class="text-gray-400 dark:text-gray-500 text-xs">10 minutes ago</p> </div> </div> <div class="flex items-center space-x-4 mb-6"> <img src="https://randomuser.me/api/portraits/men/3.jpg" alt="User Avatar" class="w-12 h-12 rounded-full shadow-md"> <div class="flex-1"> <p class="text-gray-700 dark:text-gray-300 font-medium">Steve Brown</p> <p class="text-gray-500 dark:text-gray-400 text-sm">Commented on your photo.</p> <p class="text-gray-400 dark:text-gray-500 text-xs">20 minutes ago</p> </div> </div> <div class="flex items-center space-x-4 mb-6"> <img src="https://randomuser.me/api/portraits/women/4.jpg" alt="User Avatar" class="w-12 h-12 rounded-full shadow-md"> <div class="flex-1"> <p class="text-gray-700 dark:text-gray-300 font-medium">Alice Johnson</p> <p class="text-gray-500 dark:text-gray-400 text-sm">Started following you.</p> <p class="text-gray-400 dark:text-gray-500 text-xs">30 minutes ago</p> </div> </div> <div class="flex items-center space-x-4 mb-6"> <img src="https://randomuser.me/api/portraits/men/5.jpg" alt="User Avatar" class="w-12 h-12 rounded-full shadow-md"> <div class="flex-1"> <p class="text-gray-700 dark:text-gray-300 font-medium">Michael Green</p> <p class="text-gray-500 dark:text-gray-400 text-sm">Updated his status.</p> <p class="text-gray-400 dark:text-gray-500 text-xs">1 hour ago</p> </div> </div> <div class="flex items-center space-x-4 mb-6"> <img src="https://randomuser.me/api/portraits/women/6.jpg" alt="User Avatar" class="w-12 h-12 rounded-full shadow-md"> <div class="flex-1"> <p class="text-gray-700 dark:text-gray-300 font-medium">Emily Davis</p> <p class="text-gray-500 dark:text-gray-400 text-sm">Shared a photo.</p> <p class="text-gray-400 dark:text-gray-500 text-xs">2 hours ago</p> </div> </div> <div class="flex items-center space-x-4 mb-6"> <img src="https://randomuser.me/api/portraits/men/7.jpg" alt="User Avatar" class="w-12 h-12 rounded-full shadow-md"> <div class="flex-1"> <p class="text-gray-700 dark:text-gray-300 font-medium">Chris Black</p> <p class="text-gray-500 dark:text-gray-400 text-sm">Joined the group.</p> <p class="text-gray-400 dark:text-gray-500 text-xs">3 hours ago</p> </div> </div> <div class="flex items-center space-x-4 mb-6"> <img src="https://randomuser.me/api/portraits/women/8.jpg" alt="User Avatar" class="w-12 h-12 rounded-full shadow-md"> <div class="flex-1"> <p class="text-gray-700 dark:text-gray-300 font-medium">Olivia White</p> <p class="text-gray-500 dark:text-gray-400 text-sm">Sent you a message.</p> <p class="text-gray-400 dark:text-gray-500 text-xs">4 hours ago</p> </div> </div> </div>
一个响应式布局组件,具有迷你交互和引人入胜的动画。它包含一个卡片结构,并包括用户交互,例如悬停效果、缩放和暗主题调整。
<div class="max-w-sm mx-auto"> <div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden"> <div class="p-4"> <h2 class="text-2xl font-bold text-gray-900 dark:text-white hover:text-gray-700 dark:hover:text-gray-300 transition duration-300 ease-in-out">User Profile</h2> <div class="flex items-center mt-2"> <img src="https://randomuser.me/api/portraits/men/32.jpg" alt="User Avatar" class="w-16 h-16 rounded-full border-2 border-gray-300 dark:border-gray-600 hover:scale-110 transition-transform duration-300 ease-in-out"> <div class="ml-4"> <h3 class="text-lg font-semibold text-gray-800 dark:text-gray-200">John Doe</h3> <p class="text-sm text-gray-600 dark:text-gray-400">Web Developer</p> </div> </div> </div> <div class="p-4"> <img src="https://picsum.photos/300/200?random=1" alt="Placeholder Image" class="w-full h-auto rounded-md hover:scale-105 transition-transform duration-300 ease-in-out"> </div> <div class="p-4"> <p class="text-gray-700 dark:text-gray-300">This component features engaging microinteractions that enhance user experience by providing visual feedback on actions.</p> </div> <div class="flex justify-end p-4"> <button class="bg-blue-500 text-white font-bold py-2 px-4 rounded hover:bg-blue-600 transition-all duration-300 ease-in-out">Follow</button> </div> </div> </div>
一个设计有暗模式UI的媒体组件,采用响应式效果和支持暗主题的Tailwind CSS。
<div class="bg-gray-900 text-white p-6 rounded-lg shadow-md max-w-md mx-auto mt-10"> <div class="flex items-center mb-4"> <img class="w-12 h-12 rounded-full" src="https://randomuser.me/api/portraits/men/32.jpg" alt="User Avatar"> <div class="ml-4"> <h2 class="text-xl font-bold">John Doe</h2> <p class="text-gray-400">Posted 2 hours ago</p> </div> </div> <img class="w-full rounded-lg mb-4" src="https://picsum.photos/600/400" alt="Media Content"> <h3 class="text-lg font-semibold mb-2">Amazing Scenery</h3> <p class="text-gray-300">This is a beautiful representation of nature that showcases the stunning landscapes we often take for granted.</p> <div class="mt-4 flex justify-between"> <button class="bg-red-600 text-white px-4 py-2 rounded hover:bg-red-700 focus:outline-none focus:ring focus:ring-red-300">Like</button> <button class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700 focus:outline-none focus:ring focus:ring-blue-300">Comment</button> </div> </div>
一种响应式脚部导航组件,采用擬物化风格来模仿真实世界元素,支持黑暗主题并使用Tailwind CSS。此组件包括链接、占位符图像和头像。
<footer class="bg-gray-800 text-white p-6 mt-8"> <div class="container mx-auto flex flex-col md:flex-row justify-between items-center"> <div class="flex flex-col items-center md:items-start"> <h2 class="text-lg font-bold mb-2">Stay Connected</h2> <p class="text-sm">Follow us on our social channels!</p> <div class="flex space-x-4 mt-2"> <a href="#" class="bg-blue-600 p-2 rounded-full shadow-lg transform transition-transform duration-200 hover:scale-110">FB</a> <a href="#" class="bg-blue-400 p-2 rounded-full shadow-lg transform transition-transform duration-200 hover:scale-110">TW</a> <a href="#" class="bg-red-600 p-2 rounded-full shadow-lg transform transition-transform duration-200 hover:scale-110">IG</a> </div> </div> <div class="flex flex-col items-center md:items-start mt-6 md:mt-0"> <h2 class="text-lg font-bold mb-2">About Us</h2> <ul class="text-sm space-y-1"> <li><a href="#" class="hover:underline">Our Story</a></li> <li><a href="#" class="hover:underline">Career</a></li> <li><a href="#" class="hover:underline">Contact</a></li> </ul> </div> <div class="flex flex-col items-center md:items-start mt-6 md:mt-0"> <h2 class="text-lg font-bold mb-2">User Profiles</h2> <div class="flex space-x-2"> <img src="https://randomuser.me/api/portraits/men/11.jpg" alt="User Avatar" class="w-12 h-12 rounded-full border-2 border-white shadow-md"> <img src="https://randomuser.me/api/portraits/men/12.jpg" alt="User Avatar" class="w-12 h-12 rounded-full border-2 border-white shadow-md"> <img src="https://randomuser.me/api/portraits/men/13.jpg" alt="User Avatar" class="w-12 h-12 rounded-full border-2 border-white shadow-md"> </div> </div> </div> <div class="mt-6 text-center text-sm"> <p>© 2023 Your Company. All Rights Reserved.</p> <p class="text-gray-400">Powered by <a href="#" class="text-white hover:underline">Your Technology</a></p> </div> </footer> <style> @media (prefers-color-scheme: dark) { footer { background-color: #1f1f1f; } footer a { color: #white; } footer a:hover { color: #cbd5e1; } } </style>