Toggle navigation
☰
HTML
CSS
Scripting
Database
<!doctype html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Tailwind CSS Tabs With Badges</title> <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.2.1"></script> </head> <body class="bg-gray-50 flex items-center justify-center min-h-screen p-6 antialiased" x-data="{ activeTab: 1 }"> <div class="w-full max-w-xl"> <div class="flex items-center border-b-2 border-slate-100 mb-12"> <template x-for="tab in [{id: 1, name: 'Updates', count: 12, color: 'indigo'}, {id: 2, name: 'Security', count: 0, color: 'rose'}, {id: 3, name: 'Archive', count: 4, color: 'slate'}]"> <button @click="activeTab = tab.id" class="px-6 py-6 flex items-center gap-3 transition-all relative whitespace-nowrap group cursor-pointer" :class="activeTab === tab.id ? 'text-slate-900' : 'text-slate-400 hover:text-slate-600'" > <span class="text-xs font-black uppercase tracking-widest italic" x-text="tab.name"></span> <template x-if="tab.count > 0"> <span class="px-2 py-0.5 text-[8px] font-black rounded-lg transition-all" :class="activeTab === tab.id ? 'bg-indigo-600 text-white shadow-lg shadow-indigo-100' : 'bg-slate-100 text-slate-400'" x-text="tab.count" ></span> </template> <!-- Active Line --> <div x-show="activeTab === tab.id" class="absolute -bottom-[2px] left-0 w-full h-[3px] bg-indigo-600 rounded-full" x-transition:enter="transition ease-out duration-300" x-transition:enter-start="scale-x-0" x-transition:enter-end="scale-x-100" ></div> </button> </template> </div> <div class="bg-white p-12 rounded-[3.5rem] shadow-4xl border border-white"> <div x-show="activeTab === 1" class="space-y-4"> <div class="h-2 w-2 bg-indigo-600 rounded-full animate-ping mb-6"></div> <h3 class="text-xl font-black text-slate-900 tracking-tighter italic">Pending Version Updates.</h3> <p class="text-sm text-slate-500 font-medium leading-relaxed italic">System detects 12 available patches for the current mesh configuration. Deployment is recommended within the next 4 hours.</p> </div> <div x-show="activeTab === 2" class="space-y-4"> <h3 class="text-xl font-black text-slate-900 tracking-tighter italic">Security Clearance.</h3> <p class="text-sm text-slate-500 font-medium leading-relaxed italic">All security protocols are currently verified. No unauthorized access attempts detected in the previous cycle.</p> </div> <div x-show="activeTab === 3" class="space-y-4"> <h3 class="text-xl font-black text-slate-900 tracking-tighter italic">Archived Segments.</h3> <p class="text-sm text-slate-500 font-medium leading-relaxed italic">Four historical manifests have been moved to long-term spectral storage. These remain available for read-only audit.</p> </div> </div> </div> <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script> </body> </html>