
Tailwind Css
- 322 installs
- 61 repo stars
- Updated June 13, 2026
- manutej/luxor-claude-marketplace
Build responsive web UIs with Tailwind utilities, tokens, components, forms, and accessible layouts in React or plain HTML.
About
Guides Tailwind CSS for modern web frontends: utility workflows, responsive grids, typography, hover/focus states, dark mode, form styling, and reusable components for SaaS, ecommerce, and content sites with cohesive visual systems.
- Utility-first composition
- Responsive breakpoints
- Theme and design tokens
- Accessible form styling
- Component extraction
Tailwind Css by the numbers
- 322 all-time installs (skills.sh)
- +19 installs in the week ending Aug 2, 2026 (Skillselion tracking)
- Ranked #729 of 2,245 Frontend Development skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/manutej/luxor-claude-marketplace --skill tailwind-cssAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 322 |
|---|---|
| repo stars | ★ 61 |
| Last updated | June 13, 2026 |
| Repository | manutej/luxor-claude-marketplace ↗ |
What it does
Build responsive web UIs with Tailwind utilities, tokens, components, forms, and accessible layouts in React or plain HTML.
Files
Tailwind CSS - Utility-First Framework
A comprehensive skill for mastering Tailwind CSS, the utility-first CSS framework for rapidly building custom user interfaces. This skill covers core concepts, responsive design patterns, component extraction, dark mode implementation, theme customization, and production optimization.
When to Use This Skill
Use this skill when:
- Building modern web applications with utility-first CSS approach
- Creating responsive designs that work across all device sizes
- Implementing dark mode and theme switching in applications
- Developing reusable component libraries with consistent styling
- Optimizing CSS performance for production deployments
- Customizing design systems with brand-specific tokens
- Building accessible, mobile-first user interfaces
- Integrating with frameworks like React, Vue, Svelte, or Next.js
- Prototyping and iterating on UI designs rapidly
- Maintaining design consistency across large codebases
Core Concepts
Utility-First Philosophy
Tailwind CSS takes a different approach from traditional CSS frameworks:
- Utility Classes Over Components: Instead of pre-built components, use single-purpose utility classes
- Compose in HTML: Build complex designs by composing utilities directly in your markup
- No Context Switching: Stay in your HTML/JSX without jumping to CSS files
- Design System Built-In: Consistent spacing, colors, and typography out of the box
- Responsive by Default: Every utility has responsive variants built-in
- JIT Compilation: Just-in-Time mode generates only the CSS you actually use
Key Principles
1. Single Responsibility: Each class does one thing well 2. Composability: Combine utilities to create complex designs 3. Constraints: Design system constraints lead to better, more consistent UIs 4. Flexibility: Arbitrary values for one-off customizations when needed 5. Performance: Minimal CSS output through intelligent purging
Core Utilities Reference
Layout Utilities
Display
<!-- Block and inline -->
<div class="block">Block element</div>
<span class="inline">Inline element</span>
<div class="inline-block">Inline-block</div>
<!-- Flexbox -->
<div class="flex items-center justify-between">
<div>Left</div>
<div>Right</div>
</div>
<!-- Grid -->
<div class="grid grid-cols-3 gap-4">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<!-- Hidden -->
<div class="hidden md:block">Visible on medium screens and up</div>Positioning
<!-- Static, relative, absolute, fixed, sticky -->
<div class="relative">
<div class="absolute top-0 right-0">Top-right corner</div>
</div>
<div class="fixed bottom-4 right-4">Fixed bottom-right</div>
<div class="sticky top-0">Sticky header</div>Sizing
<!-- Width and height -->
<div class="w-full h-screen">Full width, viewport height</div>
<div class="w-1/2 h-64">Half width, 16rem height</div>
<div class="w-[750px] h-[500px]">Arbitrary values</div>
<!-- Min/max -->
<div class="min-w-0 max-w-md">Constrained width</div>
<div class="min-h-screen max-h-full">Constrained height</div>Spacing Utilities
Padding and Margin
<!-- All sides -->
<div class="p-4 m-2">Padding 1rem, margin 0.5rem</div>
<!-- Individual sides -->
<div class="pt-8 pb-4 pl-6 pr-2">Individual padding</div>
<div class="mt-4 mb-8 ml-auto mr-auto">Individual margin</div>
<!-- Logical properties -->
<div class="px-4 py-2">Horizontal and vertical</div>
<div class="ps-4 pe-2">Inline start/end (RTL-aware)</div>
<!-- Negative margins -->
<div class="-mt-4 -ml-2">Negative margins for overlap</div>
<!-- Space between -->
<div class="flex space-x-4">Horizontal spacing between children</div>
<div class="flex flex-col space-y-2">Vertical spacing between children</div>Typography Utilities
Font Family, Size, and Weight
<!-- Font families -->
<p class="font-sans">Sans-serif font</p>
<p class="font-serif">Serif font</p>
<p class="font-mono">Monospace font</p>
<!-- Font sizes -->
<p class="text-xs">Extra small (0.75rem)</p>
<p class="text-sm">Small (0.875rem)</p>
<p class="text-base">Base (1rem)</p>
<p class="text-lg">Large (1.125rem)</p>
<p class="text-xl">Extra large (1.25rem)</p>
<h1 class="text-4xl">4XL heading (2.25rem)</h1>
<!-- Font weights -->
<p class="font-light">Light (300)</p>
<p class="font-normal">Normal (400)</p>
<p class="font-medium">Medium (500)</p>
<p class="font-semibold">Semibold (600)</p>
<p class="font-bold">Bold (700)</p>Text Styling
<!-- Text alignment -->
<p class="text-left">Left aligned</p>
<p class="text-center">Center aligned</p>
<p class="text-right">Right aligned</p>
<!-- Text color -->
<p class="text-gray-900">Dark gray text</p>
<p class="text-blue-600">Blue text</p>
<p class="text-red-500/75">Red text with 75% opacity</p>
<!-- Text decoration -->
<p class="underline">Underlined text</p>
<p class="line-through">Strikethrough text</p>
<a class="no-underline hover:underline">Hover underline</a>
<!-- Text transform -->
<p class="uppercase">UPPERCASE TEXT</p>
<p class="lowercase">lowercase text</p>
<p class="capitalize">Capitalize Each Word</p>
<!-- Line height and letter spacing -->
<p class="leading-tight">Tight line height</p>
<p class="leading-relaxed">Relaxed line height</p>
<p class="tracking-wide">Wide letter spacing</p>Color Utilities
Background Colors
<!-- Solid backgrounds -->
<div class="bg-white">White background</div>
<div class="bg-gray-100">Light gray background</div>
<div class="bg-blue-500">Blue background</div>
<div class="bg-red-600/50">Red background at 50% opacity</div>
<!-- Gradients -->
<div class="bg-gradient-to-r from-purple-500 to-pink-500">
Purple to pink gradient
</div>
<div class="bg-gradient-to-br from-blue-400 via-purple-500 to-pink-600">
Three-color gradient
</div>Text and Border Colors
<!-- Text colors -->
<p class="text-gray-900 dark:text-white">Adaptive text color</p>
<p class="text-blue-600 hover:text-blue-800">Interactive text color</p>
<!-- Border colors -->
<div class="border border-gray-300">Gray border</div>
<div class="border-2 border-blue-500">Thick blue border</div>
<div class="divide-y divide-gray-200">Divided children</div>Border and Rounding Utilities
<!-- Border width -->
<div class="border">1px border</div>
<div class="border-2">2px border</div>
<div class="border-t-4">4px top border only</div>
<!-- Border radius -->
<div class="rounded">0.25rem radius</div>
<div class="rounded-lg">0.5rem radius</div>
<div class="rounded-full">Full circle/pill</div>
<div class="rounded-t-lg">Round top only</div>
<!-- Border style -->
<div class="border-solid">Solid border</div>
<div class="border-dashed">Dashed border</div>
<div class="border-dotted">Dotted border</div>Shadow and Effects
<!-- Box shadows -->
<div class="shadow-sm">Small shadow</div>
<div class="shadow-md">Medium shadow</div>
<div class="shadow-lg">Large shadow</div>
<div class="shadow-xl">Extra large shadow</div>
<div class="shadow-none hover:shadow-lg">Interactive shadow</div>
<!-- Text shadow -->
<h1 class="text-shadow-lg">Large text shadow</h1>
<p class="text-shadow-sm text-shadow-gray-300">Colored text shadow</p>
<!-- Opacity -->
<div class="opacity-50">50% opacity</div>
<div class="opacity-0 hover:opacity-100">Fade in on hover</div>Responsive Design
Breakpoint System
Tailwind uses a mobile-first breakpoint system:
/* Breakpoint reference */
sm: 640px /* @media (min-width: 640px) */
md: 768px /* @media (min-width: 768px) */
lg: 1024px /* @media (min-width: 1024px) */
xl: 1280px /* @media (min-width: 1280px) */
2xl: 1536px /* @media (min-width: 1536px) */Responsive Utilities
<!-- Mobile-first approach -->
<div class="w-full md:w-1/2 lg:w-1/3">
Full width on mobile, half on tablet, third on desktop
</div>
<!-- Responsive flexbox -->
<div class="flex flex-col md:flex-row gap-4">
Vertical on mobile, horizontal on tablet+
</div>
<!-- Responsive grid -->
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
1 column mobile, 2 tablet, 4 desktop
</div>
<!-- Responsive text -->
<h1 class="text-2xl md:text-4xl lg:text-6xl">
Scales with screen size
</h1>
<!-- Show/hide at breakpoints -->
<div class="block md:hidden">Mobile only</div>
<div class="hidden md:block">Desktop only</div>
<div class="hidden md:block lg:hidden">Tablet only</div>Custom Breakpoints
/* app.css */
@import "tailwindcss";
@theme {
--breakpoint-xs: 30rem; /* 480px */
--breakpoint-3xl: 120rem; /* 1920px */
}<!-- Using custom breakpoints -->
<div class="grid xs:grid-cols-2 3xl:grid-cols-6">
Uses custom xs and 3xl breakpoints
</div>Targeting Breakpoint Ranges
<!-- Active only between md and xl -->
<div class="md:max-xl:flex">
Flex layout only on tablets
</div>
<!-- Max-width utilities -->
<div class="flex max-md:hidden">
Hidden below medium breakpoint
</div>Container Queries
<!-- Container-based responsive design -->
<div class="@container">
<div class="@lg:grid-cols-3 grid grid-cols-1">
Responds to container size, not viewport
</div>
</div>
<!-- Arbitrary container queries -->
<div class="@container">
<div class="flex flex-col @min-[475px]:flex-row">
Custom container breakpoint
</div>
</div>
<!-- Using container query units -->
<div class="@container">
<div class="w-[50cqw]">
50% of container width
</div>
</div>Dark Mode Implementation
Automatic Dark Mode (Media Query)
Default behavior based on system preference:
<!-- Automatically adapts to system preference -->
<div class="bg-white dark:bg-gray-900 text-gray-900 dark:text-white">
<div class="bg-gray-100 dark:bg-gray-800 p-6 rounded-lg">
<h3 class="text-gray-900 dark:text-white font-semibold">
Card Title
</h3>
<p class="text-gray-500 dark:text-gray-400">
Content automatically adapts to color scheme preference
</p>
</div>
</div>Manual Dark Mode (Class-Based)
Configure custom variant for manual control:
/* app.css */
@import "tailwindcss";
@custom-variant dark (&:where(.dark, .dark *));<!-- Toggle dark mode with class -->
<html class="dark">
<body>
<div class="bg-white dark:bg-black">
Controlled by .dark class on ancestor
</div>
</body>
</html>Dark Mode Toggle Logic
// Dark mode toggle with localStorage persistence
// Add inline in <head> to avoid FOUC (Flash of Unstyled Content)
document.documentElement.classList.toggle(
"dark",
localStorage.theme === "dark" ||
(!("theme" in localStorage) &&
window.matchMedia("(prefers-color-scheme: dark)").matches)
);
// User explicitly chooses light mode
function setLightMode() {
localStorage.theme = "light";
document.documentElement.classList.remove("dark");
}
// User explicitly chooses dark mode
function setDarkMode() {
localStorage.theme = "dark";
document.documentElement.classList.add("dark");
}
// User chooses to respect OS preference
function setSystemMode() {
localStorage.removeItem("theme");
document.documentElement.classList.toggle(
"dark",
window.matchMedia("(prefers-color-scheme: dark)").matches
);
}Data Attribute Dark Mode
Alternative approach using data attributes:
/* app.css */
@import "tailwindcss";
@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));<html data-theme="dark">
<body>
<div class="bg-white dark:bg-black">
Uses data-theme attribute
</div>
</body>
</html>State Variants
Interactive States
<!-- Hover, focus, active states -->
<button class="
bg-blue-500
hover:bg-blue-600
focus:bg-blue-700
active:bg-blue-800
focus:outline-2
focus:outline-offset-2
focus:outline-blue-500
">
Interactive button
</button>
<!-- Disabled state -->
<button class="
bg-blue-500
disabled:opacity-50
disabled:cursor-not-allowed
" disabled>
Disabled button
</button>
<!-- Focus within -->
<div class="border-2 border-transparent focus-within:border-blue-500">
<input class="outline-none" placeholder="Focus container changes" />
</div>Form States
<!-- Input states -->
<input class="
border
border-gray-300
focus:border-blue-500
focus:ring-2
focus:ring-blue-200
invalid:border-red-500
placeholder:text-gray-400
" />
<!-- Checkbox and radio -->
<input type="checkbox" class="
checked:bg-blue-500
indeterminate:bg-gray-500
" />
<!-- File input -->
<input type="file" class="
file:mr-4
file:rounded-full
file:border-0
file:bg-violet-50
file:px-4
file:py-2
file:text-sm
file:font-semibold
hover:file:bg-violet-100
" />Pseudo-Classes and Pseudo-Elements
<!-- First, last, odd, even -->
<ul>
<li class="first:font-bold">First item is bold</li>
<li class="even:bg-gray-100">Even items have background</li>
<li class="last:border-b-0">Last item has no border</li>
</ul>
<!-- Before and after -->
<div class="
before:content-['→']
before:mr-2
after:content-['←']
after:ml-2
">
Content with decorations
</div>
<!-- Group hover -->
<div class="group">
<img class="group-hover:opacity-75" src="..." />
<p class="group-hover:text-blue-600">Hover parent to affect children</p>
</div>
<!-- Peer state -->
<input type="checkbox" class="peer" id="toggle" />
<label class="peer-checked:text-blue-600" for="toggle">
Changes when checkbox is checked
</label>Media Query Variants
<!-- Motion preferences -->
<button class="
transition
hover:-translate-y-1
motion-reduce:transition-none
motion-reduce:hover:translate-y-0
">
Respects user motion preference
</button>
<!-- Contrast preferences -->
<label>
<input class="contrast-more:border-gray-400" />
<p class="opacity-75 contrast-more:opacity-100">
Adjusts for contrast needs
</p>
</label>
<!-- Print styles -->
<article class="print:hidden">Not shown when printing</article>
<div class="hidden print:block">Only visible in print</div>
<!-- Orientation -->
<div class="portrait:hidden">Hidden in portrait mode</div>
<div class="landscape:grid-cols-2">Adapts to orientation</div>Component Extraction Patterns
When to Extract Components
Extract components when:
1. Repeated Patterns: Same utility combinations used multiple times 2. Semantic Meaning: Pattern represents a specific UI element (button, card) 3. Team Communication: Need to share consistent components 4. Maintenance: Changes should propagate to all instances
Framework Component Extraction
React Components
// Button.jsx - Reusable component with variants
export function Button({ size = 'md', variant = 'primary', children, ...props }) {
const baseStyles = "font-bold rounded transition focus:outline-2 focus:outline-offset-2";
const sizeStyles = {
sm: "px-3 py-1.5 text-sm",
md: "px-4 py-2 text-base",
lg: "px-5 py-3 text-lg"
};
const variantStyles = {
primary: "bg-blue-500 text-white hover:bg-blue-600 focus:outline-blue-500",
secondary: "bg-gray-200 text-gray-900 hover:bg-gray-300 focus:outline-gray-500",
danger: "bg-red-500 text-white hover:bg-red-600 focus:outline-red-500"
};
return (
<button
className={`${baseStyles} ${sizeStyles[size]} ${variantStyles[variant]}`}
{...props}
>
{children}
</button>
);
}
// Usage
<Button size="lg" variant="primary">Save Changes</Button>
<Button size="sm" variant="danger">Delete</Button>Vue Components
<!-- Card.vue -->
<template>
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6">
<h3 class="text-xl font-semibold text-gray-900 dark:text-white mb-2">
{{ title }}
</h3>
<p class="text-gray-600 dark:text-gray-400">
<slot />
</p>
</div>
</template>
<script>
export default {
props: {
title: {
type: String,
required: true
}
}
}
</script>
<!-- Usage -->
<Card title="Feature Title">
This is the card content that adapts to dark mode.
</Card>Svelte Components
<!-- Alert.svelte -->
<script>
export let type = 'info'; // info, success, warning, error
const styles = {
info: 'bg-blue-50 border-blue-200 text-blue-800',
success: 'bg-green-50 border-green-200 text-green-800',
warning: 'bg-yellow-50 border-yellow-200 text-yellow-800',
error: 'bg-red-50 border-red-200 text-red-800'
};
</script>
<div class="border-l-4 p-4 {styles[type]}" role="alert">
<slot />
</div>
<!-- Usage -->
<Alert type="success">
Your changes have been saved successfully!
</Alert>CSS Component Classes
For non-component frameworks or shared styles:
/* app.css */
@import "tailwindcss";
/* Component layer for reusable patterns */
@layer components {
.btn {
@apply font-bold py-2 px-4 rounded transition;
}
.btn-primary {
@apply bg-blue-500 text-white;
@apply hover:bg-blue-600;
@apply focus:outline-2 focus:outline-offset-2 focus:outline-blue-500;
}
.btn-secondary {
@apply bg-gray-200 text-gray-900;
@apply hover:bg-gray-300;
}
.card {
@apply bg-white rounded-lg shadow-xl p-6;
@apply dark:bg-gray-800;
}
.input-field {
@apply border border-gray-300 rounded px-3 py-2;
@apply focus:border-blue-500 focus:ring-2 focus:ring-blue-200;
@apply dark:bg-gray-700 dark:border-gray-600;
}
}<!-- Using component classes -->
<button class="btn btn-primary">Primary Action</button>
<div class="card">
<h3>Card Title</h3>
<p>Card content</p>
</div>
<input class="input-field" placeholder="Enter text..." />Theme Customization
Extending the Theme
/* app.css */
@import "tailwindcss";
@theme {
/* Custom colors */
--color-primary: #6366f1;
--color-secondary: #8b5cf6;
--color-brand-blue: #3b82f6;
--color-brand-purple: #a855f7;
/* Custom spacing */
--spacing-18: 4.5rem;
--spacing-72: 18rem;
/* Custom breakpoints */
--breakpoint-xs: 30rem;
--breakpoint-3xl: 120rem;
/* Custom fonts */
--font-display: "Montserrat", sans-serif;
--font-body: "Inter", sans-serif;
/* Custom shadows */
--shadow-glow: 0 0 20px rgba(99, 102, 241, 0.5);
/* Custom border radius */
--radius-4xl: 2rem;
/* Custom z-index */
--z-index-dropdown: 1000;
--z-index-modal: 2000;
}<!-- Using custom theme values -->
<div class="bg-primary text-white">Primary color</div>
<div class="font-display text-4xl">Display font</div>
<div class="shadow-glow rounded-4xl">Custom shadow and radius</div>
<div class="xs:grid-cols-2 3xl:grid-cols-6">Custom breakpoints</div>Using CSS Variables
/* Dynamic theming with CSS variables */
@import "tailwindcss";
@theme {
--color-primary-50: oklch(0.95 0.02 250);
--color-primary-100: oklch(0.90 0.04 250);
--color-primary-200: oklch(0.85 0.08 250);
--color-primary-500: oklch(0.55 0.22 250);
--color-primary-900: oklch(0.25 0.15 250);
}<!-- Arbitrary values with CSS variables -->
<div class="bg-[var(--color-primary-500)]">
Using CSS variable
</div>
<!-- Setting CSS variables inline -->
<div class="[--spacing:1rem] lg:[--spacing:2rem]">
<div class="p-[var(--spacing)]">
Responsive custom property
</div>
</div>Custom Utilities
Simple Custom Utilities
/* app.css */
@import "tailwindcss";
/* Simple utility */
@utility content-auto {
content-visibility: auto;
}
/* Complex utility with nesting */
@utility scrollbar-hidden {
&::-webkit-scrollbar {
display: none;
}
scrollbar-width: none;
}<!-- Using custom utilities -->
<div class="content-auto hover:content-auto">
Supports all variants automatically
</div>
<div class="scrollbar-hidden">
Hidden scrollbar
</div>Functional Custom Utilities
/* app.css */
@import "tailwindcss";
/* Define theme values */
@theme {
--tab-size-2: 2;
--tab-size-4: 4;
--tab-size-8: 8;
}
/* Functional utility accepting arguments */
@utility tab-* {
tab-size: --value(--tab-size-*);
}
/* Utility with modifiers */
@utility text-* {
font-size: --value(--text-*, [length]);
line-height: --modifier(--leading-*, [length], [*]);
}
/* Supporting arbitrary values */
@utility opacity-* {
opacity: --value([percentage]);
opacity: calc(--value(integer) * 1%);
opacity: --value(--opacity-*);
}<!-- Using functional utilities -->
<div class="tab-4">Tab size 4</div>
<div class="tab-[12]">Arbitrary tab size</div>
<p class="text-2xl/relaxed">Font size with line height modifier</p>
<div class="opacity-50">50% opacity from theme</div>
<div class="opacity-[0.35]">Arbitrary opacity</div>Production Optimization
Build Configuration
// vite.config.ts
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [
tailwindcss(),
],
build: {
minify: 'terser',
cssMinify: true,
}
})Content Configuration
Ensure Tailwind scans all files:
/* app.css */
@import "tailwindcss";
@source "../../**/*.{html,js,jsx,ts,tsx,vue,svelte}";Performance Best Practices
1. Use JIT Mode (enabled by default in v4)
- Only generates CSS for classes you use
- Fast build times
- Smaller file sizes
2. Minimize Arbitrary Values
- Use theme values when possible
- Arbitrary values prevent reuse and increase CSS size
3. Avoid Deep Nesting
- Keep utility combinations reasonable
- Extract components for complex patterns
4. Optimize Images
<img
class="w-full h-auto"
src="/image.jpg"
loading="lazy"
decoding="async"
/>5. Use CSS Containment
<div class="content-auto">
Browser can optimize rendering
</div>Production Build Checklist
- [ ] Enable CSS minification
- [ ] Configure content sources correctly
- [ ] Remove unused custom utilities
- [ ] Optimize image assets
- [ ] Test dark mode variants
- [ ] Verify responsive breakpoints
- [ ] Check accessibility (contrast, focus states)
- [ ] Test performance (Lighthouse scores)
Plugins and Extensions
Official Plugins
Typography Plugin
npm install @tailwindcss/typography<!-- Beautiful typography for markdown/CMS content -->
<article class="prose lg:prose-xl dark:prose-invert">
<h1>Article Title</h1>
<p>Automatically styled content with sensible defaults.</p>
</article>Forms Plugin
npm install @tailwindcss/forms<!-- Better default form styles -->
<form class="space-y-4">
<input type="text" class="form-input rounded-md" />
<select class="form-select rounded-md"></select>
<textarea class="form-textarea rounded-md"></textarea>
</form>Container Queries Plugin
npm install @tailwindcss/container-queries<div class="@container">
<div class="@lg:grid-cols-3">
Responds to container, not viewport
</div>
</div>Framework Integration
React / Next.js
// tailwind.config.ts
import type { Config } from 'tailwindcss'
export default {
content: [
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
],
} satisfies Config// Component with Tailwind
export default function Hero() {
return (
<section className="bg-gradient-to-r from-blue-500 to-purple-600 text-white py-20">
<div className="container mx-auto px-4">
<h1 className="text-5xl font-bold mb-4">Welcome</h1>
<p className="text-xl">Beautiful UI with Tailwind CSS</p>
</div>
</section>
)
}Vue / Nuxt
// nuxt.config.ts
import tailwindcss from "@tailwindcss/vite";
export default defineNuxtConfig({
vite: {
plugins: [tailwindcss()],
},
})Svelte / SvelteKit
// vite.config.ts
import { sveltekit } from '@sveltejs/kit/vite';
import tailwindcss from '@tailwindcss/vite';
export default {
plugins: [tailwindcss(), sveltekit()],
};Best Practices
Naming and Organization
1. Use Semantic HTML
<!-- Good -->
<article class="bg-white rounded-lg p-6">
<h2 class="text-2xl font-bold">Title</h2>
</article>
<!-- Avoid -->
<div class="bg-white rounded-lg p-6">
<div class="text-2xl font-bold">Title</div>
</div>2. Order Utilities Consistently
<!-- Suggested order: layout → spacing → sizing → typography → visual → misc -->
<div class="
flex items-center justify-between
p-4 mx-auto
w-full max-w-4xl
text-lg font-semibold
bg-white rounded-lg shadow-md
hover:shadow-lg transition
">3. Extract Repeated Patterns
// Don't repeat long class strings
const cardClasses = "bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6";
<div className={cardClasses}>Card 1</div>
<div className={cardClasses}>Card 2</div>Accessibility
<!-- Focus states -->
<button class="focus:outline-2 focus:outline-offset-2 focus:outline-blue-500">
Accessible button
</button>
<!-- Screen reader only -->
<span class="sr-only">Additional context for screen readers</span>
<!-- High contrast mode -->
<div class="border border-gray-300 forced-colors:border-current">
Adapts to forced colors mode
</div>
<!-- Reduced motion -->
<div class="transition-transform motion-reduce:transition-none">
Respects prefers-reduced-motion
</div>Performance
1. Avoid Inline Styles for Dynamic Values
// Good - use CSS variables
<button
style={{ backgroundColor: buttonColor }}
className="rounded-md px-3 py-1.5"
>
// Avoid - generates unique CSS for each color
<button className={`bg-[${buttonColor}]`}>2. Leverage Purging
- Ensure content paths are correct
- Remove unused custom utilities
- Test production builds
3. Optimize for First Paint
<!-- Inline critical CSS in <head> -->
<style>
.hero { /* Critical above-fold styles */ }
</style>Common Patterns
Navigation Bar
<nav class="bg-white dark:bg-gray-900 shadow-lg">
<div class="container mx-auto px-4">
<div class="flex items-center justify-between h-16">
<!-- Logo -->
<div class="flex items-center">
<img class="h-8 w-auto" src="/logo.svg" alt="Logo" />
</div>
<!-- Desktop Navigation -->
<div class="hidden md:flex items-center space-x-8">
<a href="#" class="text-gray-900 dark:text-white hover:text-blue-600">Home</a>
<a href="#" class="text-gray-900 dark:text-white hover:text-blue-600">About</a>
<a href="#" class="text-gray-900 dark:text-white hover:text-blue-600">Contact</a>
</div>
<!-- Mobile menu button -->
<button class="md:hidden p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800">
<svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
</svg>
</button>
</div>
</div>
</nav>Hero Section
<section class="relative bg-gradient-to-r from-blue-600 to-purple-600 text-white py-20 lg:py-32">
<div class="container mx-auto px-4">
<div class="max-w-3xl mx-auto text-center">
<h1 class="text-4xl md:text-5xl lg:text-6xl font-bold mb-6">
Build Amazing Websites
</h1>
<p class="text-xl md:text-2xl mb-8 text-blue-100">
Create beautiful, responsive designs with Tailwind CSS
</p>
<div class="flex flex-col sm:flex-row gap-4 justify-center">
<button class="bg-white text-blue-600 px-8 py-3 rounded-lg font-semibold hover:bg-blue-50 transition">
Get Started
</button>
<button class="border-2 border-white text-white px-8 py-3 rounded-lg font-semibold hover:bg-white hover:text-blue-600 transition">
Learn More
</button>
</div>
</div>
</div>
</section>Feature Grid
<section class="py-16 bg-gray-50 dark:bg-gray-900">
<div class="container mx-auto px-4">
<h2 class="text-3xl font-bold text-center mb-12 text-gray-900 dark:text-white">
Our Features
</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<!-- Feature Card -->
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6 hover:shadow-xl transition">
<div class="w-12 h-12 bg-blue-500 rounded-lg flex items-center justify-center mb-4">
<svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
</svg>
</div>
<h3 class="text-xl font-semibold mb-2 text-gray-900 dark:text-white">
Lightning Fast
</h3>
<p class="text-gray-600 dark:text-gray-400">
Build and ship faster with utility-first CSS approach.
</p>
</div>
<!-- More feature cards... -->
</div>
</div>
</section>Troubleshooting
Common Issues
Styles not applying
- Check content configuration in CSS
- Ensure classes are written correctly (no typos)
- Verify build process is running
- Check for CSS specificity conflicts
Dark mode not working
- Verify dark variant configuration
- Check if dark class is applied to HTML element
- Ensure localStorage logic is correct
- Test system preference detection
Responsive classes not working
- Verify breakpoint configuration
- Check mobile-first approach (base → larger)
- Ensure viewport meta tag is present
- Test in actual devices/browser dev tools
Build is slow
- Use JIT mode (default in v4)
- Optimize content paths
- Remove unnecessary dependencies
- Check for circular imports
File size too large
- Configure content paths correctly
- Remove unused custom utilities
- Enable CSS minification
- Audit third-party dependencies
Resources
- Official Documentation: https://tailwindcss.com
- Tailwind UI Components: https://tailwindui.com
- Headless UI: https://headlessui.com
- Tailwind Play (Online Editor): https://play.tailwindcss.com
- GitHub Repository: https://github.com/tailwindlabs/tailwindcss
- Community Discord: https://tailwindcss.com/discord
- YouTube Channel: https://www.youtube.com/tailwindlabs
---
Skill Version: 1.0.0 Last Updated: October 2025 Skill Category: CSS Framework, UI Development, Design Systems Compatible With: React, Vue, Svelte, Next.js, Nuxt, SvelteKit, Astro, and vanilla HTML
Tailwind CSS Component Examples
Comprehensive collection of production-ready component patterns and examples using Tailwind CSS.
Table of Contents
1. Navigation Components 2. Hero Sections 3. Cards 4. Forms 5. Buttons 6. Modals and Dialogs 7. Alerts and Notifications 8. Layout Patterns 9. Tables 10. Lists 11. Avatars and Badges 12. Loading States
---
Navigation Components
Responsive Navigation Bar
<nav class="bg-white dark:bg-gray-900 shadow-lg">
<div class="container mx-auto px-4">
<div class="flex items-center justify-between h-16">
<!-- Logo -->
<div class="flex items-center space-x-3">
<img class="h-8 w-auto" src="/logo.svg" alt="Company Logo" />
<span class="text-xl font-bold text-gray-900 dark:text-white">
Brand
</span>
</div>
<!-- Desktop Navigation -->
<div class="hidden md:flex items-center space-x-8">
<a href="#" class="text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition">
Home
</a>
<a href="#" class="text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition">
Products
</a>
<a href="#" class="text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition">
About
</a>
<a href="#" class="text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition">
Contact
</a>
</div>
<!-- CTA Button -->
<div class="hidden md:block">
<button class="bg-blue-600 text-white px-6 py-2 rounded-lg hover:bg-blue-700 transition">
Get Started
</button>
</div>
<!-- Mobile menu button -->
<button class="md:hidden p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition">
<svg class="h-6 w-6 text-gray-700 dark:text-gray-300" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
</svg>
</button>
</div>
<!-- Mobile Navigation -->
<div class="md:hidden pb-4 space-y-2">
<a href="#" class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition">
Home
</a>
<a href="#" class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition">
Products
</a>
<a href="#" class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition">
About
</a>
<a href="#" class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition">
Contact
</a>
<button class="w-full mt-2 bg-blue-600 text-white px-6 py-2 rounded-lg hover:bg-blue-700 transition">
Get Started
</button>
</div>
</div>
</nav>Vertical Sidebar Navigation
<aside class="w-64 bg-gray-900 text-white min-h-screen p-4">
<!-- Logo -->
<div class="flex items-center space-x-2 mb-8">
<div class="w-8 h-8 bg-blue-500 rounded-lg"></div>
<span class="text-xl font-bold">Dashboard</span>
</div>
<!-- Navigation Links -->
<nav class="space-y-2">
<a href="#" class="flex items-center space-x-3 px-4 py-3 rounded-lg bg-blue-600 text-white">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
</svg>
<span>Home</span>
</a>
<a href="#" class="flex items-center space-x-3 px-4 py-3 rounded-lg text-gray-300 hover:bg-gray-800 transition">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
</svg>
<span>Analytics</span>
</a>
<a href="#" class="flex items-center space-x-3 px-4 py-3 rounded-lg text-gray-300 hover:bg-gray-800 transition">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" />
</svg>
<span>Team</span>
</a>
<a href="#" class="flex items-center space-x-3 px-4 py-3 rounded-lg text-gray-300 hover:bg-gray-800 transition">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
<span>Settings</span>
</a>
</nav>
<!-- User Profile -->
<div class="absolute bottom-4 left-4 right-4">
<div class="flex items-center space-x-3 p-3 rounded-lg bg-gray-800">
<img class="w-10 h-10 rounded-full" src="/avatar.jpg" alt="User" />
<div class="flex-1 min-w-0">
<p class="text-sm font-medium truncate">John Doe</p>
<p class="text-xs text-gray-400 truncate">john@example.com</p>
</div>
</div>
</div>
</aside>---
Hero Sections
Gradient Hero with CTA
<section class="relative bg-gradient-to-br from-blue-600 via-purple-600 to-pink-600 text-white py-20 lg:py-32 overflow-hidden">
<!-- Background decoration -->
<div class="absolute inset-0 opacity-20">
<div class="absolute top-0 left-0 w-96 h-96 bg-white rounded-full blur-3xl"></div>
<div class="absolute bottom-0 right-0 w-96 h-96 bg-white rounded-full blur-3xl"></div>
</div>
<div class="container mx-auto px-4 relative">
<div class="max-w-4xl mx-auto text-center">
<!-- Badge -->
<div class="inline-flex items-center px-4 py-2 mb-6 bg-white/10 backdrop-blur-sm rounded-full">
<span class="text-sm font-semibold">New: Version 2.0 is here</span>
</div>
<!-- Heading -->
<h1 class="text-4xl md:text-5xl lg:text-7xl font-bold mb-6 leading-tight">
Build Amazing Websites
<span class="block text-transparent bg-clip-text bg-gradient-to-r from-yellow-200 to-pink-200">
Faster Than Ever
</span>
</h1>
<!-- Description -->
<p class="text-xl md:text-2xl mb-10 text-blue-100 max-w-2xl mx-auto">
Create beautiful, responsive designs with our powerful framework.
Ship faster, iterate quicker, and delight your users.
</p>
<!-- CTA Buttons -->
<div class="flex flex-col sm:flex-row gap-4 justify-center items-center">
<button class="w-full sm:w-auto bg-white text-blue-600 px-8 py-4 rounded-lg font-semibold text-lg hover:bg-blue-50 transform hover:scale-105 transition shadow-xl">
Get Started Free
</button>
<button class="w-full sm:w-auto border-2 border-white text-white px-8 py-4 rounded-lg font-semibold text-lg hover:bg-white hover:text-blue-600 transition">
View Demo
</button>
</div>
<!-- Social Proof -->
<div class="mt-12 flex flex-col sm:flex-row items-center justify-center gap-8 text-sm">
<div class="flex items-center">
<div class="flex -space-x-2 mr-3">
<img class="w-8 h-8 rounded-full border-2 border-white" src="/avatar1.jpg" alt="" />
<img class="w-8 h-8 rounded-full border-2 border-white" src="/avatar2.jpg" alt="" />
<img class="w-8 h-8 rounded-full border-2 border-white" src="/avatar3.jpg" alt="" />
</div>
<span>Trusted by 10,000+ developers</span>
</div>
<div class="flex items-center gap-2">
<svg class="w-5 h-5 text-yellow-300" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
</svg>
<span>4.9/5 average rating</span>
</div>
</div>
</div>
</div>
</section>Split Hero with Image
<section class="bg-white dark:bg-gray-900">
<div class="container mx-auto px-4 py-16 lg:py-24">
<div class="grid lg:grid-cols-2 gap-12 items-center">
<!-- Content -->
<div>
<div class="inline-block px-3 py-1 mb-4 text-sm font-semibold text-blue-600 bg-blue-100 rounded-full dark:bg-blue-900 dark:text-blue-300">
Introducing v2.0
</div>
<h1 class="text-4xl lg:text-6xl font-bold text-gray-900 dark:text-white mb-6">
The Future of Web Development
</h1>
<p class="text-xl text-gray-600 dark:text-gray-400 mb-8">
Build modern, responsive websites with our powerful framework.
No configuration needed, just start building.
</p>
<div class="flex flex-col sm:flex-row gap-4">
<button class="bg-blue-600 text-white px-8 py-3 rounded-lg font-semibold hover:bg-blue-700 transition">
Start Building
</button>
<button class="border-2 border-gray-300 text-gray-700 dark:text-gray-300 dark:border-gray-600 px-8 py-3 rounded-lg font-semibold hover:border-blue-600 hover:text-blue-600 transition">
View Documentation
</button>
</div>
<!-- Features -->
<div class="grid grid-cols-2 gap-6 mt-12">
<div class="flex items-start space-x-3">
<svg class="w-6 h-6 text-green-500 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
</svg>
<div>
<p class="font-semibold text-gray-900 dark:text-white">Lightning Fast</p>
<p class="text-sm text-gray-600 dark:text-gray-400">Optimized performance</p>
</div>
</div>
<div class="flex items-start space-x-3">
<svg class="w-6 h-6 text-green-500 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
</svg>
<div>
<p class="font-semibold text-gray-900 dark:text-white">Mobile First</p>
<p class="text-sm text-gray-600 dark:text-gray-400">Responsive by default</p>
</div>
</div>
</div>
</div>
<!-- Image -->
<div class="relative">
<div class="aspect-square rounded-2xl overflow-hidden shadow-2xl">
<img
class="w-full h-full object-cover"
src="/hero-image.jpg"
alt="Product showcase"
/>
</div>
<!-- Floating card -->
<div class="absolute bottom-8 left-8 bg-white dark:bg-gray-800 rounded-lg shadow-xl p-4 max-w-xs">
<div class="flex items-center space-x-3">
<div class="w-12 h-12 bg-green-100 dark:bg-green-900 rounded-full flex items-center justify-center">
<svg class="w-6 h-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
</svg>
</div>
<div>
<p class="text-sm font-semibold text-gray-900 dark:text-white">99.9% Uptime</p>
<p class="text-xs text-gray-600 dark:text-gray-400">Reliable infrastructure</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>---
Cards
Feature Card
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-lg p-8 hover:shadow-2xl transition-shadow">
<!-- Icon -->
<div class="w-16 h-16 bg-gradient-to-br from-blue-500 to-purple-600 rounded-xl flex items-center justify-center mb-6">
<svg class="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
</svg>
</div>
<!-- Title -->
<h3 class="text-2xl font-bold text-gray-900 dark:text-white mb-3">
Lightning Fast
</h3>
<!-- Description -->
<p class="text-gray-600 dark:text-gray-400 mb-6">
Optimized for performance with minimal overhead. Build blazing fast
websites that your users will love.
</p>
<!-- Link -->
<a href="#" class="inline-flex items-center text-blue-600 hover:text-blue-700 font-semibold group">
Learn more
<svg class="w-4 h-4 ml-2 group-hover:translate-x-1 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
</svg>
</a>
</div>Product Card
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden group">
<!-- Image -->
<div class="relative overflow-hidden bg-gray-200 dark:bg-gray-700 aspect-square">
<img
class="w-full h-full object-cover group-hover:scale-110 transition-transform duration-300"
src="/product.jpg"
alt="Product"
/>
<!-- Badge -->
<div class="absolute top-4 right-4 bg-red-500 text-white text-xs font-bold px-3 py-1 rounded-full">
SALE
</div>
<!-- Quick Actions -->
<div class="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2">
<button class="bg-white text-gray-900 p-3 rounded-full hover:bg-gray-100 transition">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
</svg>
</button>
<button class="bg-white text-gray-900 p-3 rounded-full hover:bg-gray-100 transition">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z" />
</svg>
</button>
</div>
</div>
<!-- Content -->
<div class="p-6">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">
Premium Wireless Headphones
</h3>
<p class="text-sm text-gray-600 dark:text-gray-400 mb-4">
High-quality sound with active noise cancellation
</p>
<!-- Rating -->
<div class="flex items-center mb-4">
<div class="flex text-yellow-400">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
</svg>
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
</svg>
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
</svg>
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
</svg>
<svg class="w-4 h-4 text-gray-300" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
</svg>
</div>
<span class="ml-2 text-sm text-gray-600 dark:text-gray-400">(128 reviews)</span>
</div>
<!-- Price and CTA -->
<div class="flex items-center justify-between">
<div>
<span class="text-2xl font-bold text-gray-900 dark:text-white">$299</span>
<span class="ml-2 text-sm text-gray-500 line-through">$399</span>
</div>
<button class="bg-blue-600 text-white px-6 py-2 rounded-lg hover:bg-blue-700 transition">
Add to Cart
</button>
</div>
</div>
</div>---
Forms
Contact Form
<form class="bg-white dark:bg-gray-800 rounded-xl shadow-lg p-8 max-w-2xl mx-auto">
<h2 class="text-3xl font-bold text-gray-900 dark:text-white mb-6">
Get in Touch
</h2>
<div class="space-y-6">
<!-- Name -->
<div>
<label for="name" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Full Name
</label>
<input
type="text"
id="name"
class="w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white transition"
placeholder="John Doe"
/>
</div>
<!-- Email -->
<div>
<label for="email" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Email Address
</label>
<input
type="email"
id="email"
class="w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white transition"
placeholder="john@example.com"
/>
</div>
<!-- Subject -->
<div>
<label for="subject" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Subject
</label>
<select
id="subject"
class="w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white transition"
>
<option>General Inquiry</option>
<option>Support Request</option>
<option>Sales Question</option>
<option>Partnership Opportunity</option>
</select>
</div>
<!-- Message -->
<div>
<label for="message" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Message
</label>
<textarea
id="message"
rows="5"
class="w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white transition resize-none"
placeholder="Tell us about your project..."
></textarea>
</div>
<!-- Checkbox -->
<div class="flex items-start">
<input
type="checkbox"
id="newsletter"
class="w-5 h-5 text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 mt-0.5"
/>
<label for="newsletter" class="ml-3 text-sm text-gray-700 dark:text-gray-300">
Subscribe to our newsletter for updates and exclusive offers.
</label>
</div>
<!-- Submit Button -->
<button
type="submit"
class="w-full bg-blue-600 text-white py-3 rounded-lg font-semibold hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition"
>
Send Message
</button>
</div>
</form>Login Form
<div class="min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900 py-12 px-4">
<div class="max-w-md w-full space-y-8">
<div class="text-center">
<h2 class="text-3xl font-bold text-gray-900 dark:text-white">
Welcome back
</h2>
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">
Please sign in to your account
</p>
</div>
<form class="mt-8 space-y-6">
<div class="space-y-4">
<!-- Email -->
<div>
<label for="email-login" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Email address
</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 12a4 4 0 10-8 0 4 4 0 008 0zm0 0v1.5a2.5 2.5 0 005 0V12a9 9 0 10-9 9m4.5-1.206a8.959 8.959 0 01-4.5 1.207" />
</svg>
</div>
<input
id="email-login"
type="email"
class="block w-full pl-10 pr-3 py-3 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-800 dark:text-white"
placeholder="you@example.com"
/>
</div>
</div>
<!-- Password -->
<div>
<label for="password" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Password
</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
</svg>
</div>
<input
id="password"
type="password"
class="block w-full pl-10 pr-3 py-3 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-800 dark:text-white"
placeholder="••••••••"
/>
</div>
</div>
</div>
<!-- Remember and Forgot -->
<div class="flex items-center justify-between">
<div class="flex items-center">
<input
id="remember"
type="checkbox"
class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"
/>
<label for="remember" class="ml-2 block text-sm text-gray-700 dark:text-gray-300">
Remember me
</label>
</div>
<a href="#" class="text-sm font-medium text-blue-600 hover:text-blue-500">
Forgot password?
</a>
</div>
<!-- Submit -->
<button
type="submit"
class="w-full bg-blue-600 text-white py-3 rounded-lg font-semibold hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition"
>
Sign in
</button>
<!-- Divider -->
<div class="relative">
<div class="absolute inset-0 flex items-center">
<div class="w-full border-t border-gray-300 dark:border-gray-600"></div>
</div>
<div class="relative flex justify-center text-sm">
<span class="px-2 bg-gray-50 dark:bg-gray-900 text-gray-500">Or continue with</span>
</div>
</div>
<!-- Social Login -->
<div class="grid grid-cols-2 gap-4">
<button
type="button"
class="flex items-center justify-center gap-2 px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition"
>
<svg class="w-5 h-5" viewBox="0 0 24 24">
<path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/>
<path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/>
<path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/>
<path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/>
</svg>
Google
</button>
<button
type="button"
class="flex items-center justify-center gap-2 px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition"
>
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
</svg>
GitHub
</button>
</div>
<!-- Sign up link -->
<p class="text-center text-sm text-gray-600 dark:text-gray-400">
Don't have an account?
<a href="#" class="font-medium text-blue-600 hover:text-blue-500">
Sign up
</a>
</p>
</form>
</div>
</div>---
Buttons
Button Variants
<!-- Primary Button -->
<button class="bg-blue-600 text-white px-6 py-3 rounded-lg font-semibold hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition">
Primary Button
</button>
<!-- Secondary Button -->
<button class="bg-gray-200 text-gray-900 px-6 py-3 rounded-lg font-semibold hover:bg-gray-300 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-500 transition">
Secondary Button
</button>
<!-- Outline Button -->
<button class="border-2 border-blue-600 text-blue-600 px-6 py-3 rounded-lg font-semibold hover:bg-blue-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 transition">
Outline Button
</button>
<!-- Ghost Button -->
<button class="text-blue-600 px-6 py-3 rounded-lg font-semibold hover:bg-blue-50 dark:hover:bg-blue-900/20 focus:outline-none focus:ring-2 focus:ring-blue-500 transition">
Ghost Button
</button>
<!-- Danger Button -->
<button class="bg-red-600 text-white px-6 py-3 rounded-lg font-semibold hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 transition">
Danger Button
</button>
<!-- Success Button -->
<button class="bg-green-600 text-white px-6 py-3 rounded-lg font-semibold hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 transition">
Success Button
</button>
<!-- Disabled Button -->
<button
disabled
class="bg-gray-300 text-gray-500 px-6 py-3 rounded-lg font-semibold cursor-not-allowed opacity-60"
>
Disabled Button
</button>
<!-- Loading Button -->
<button class="bg-blue-600 text-white px-6 py-3 rounded-lg font-semibold flex items-center gap-2" disabled>
<svg class="animate-spin h-5 w-5 text-white" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
Loading...
</button>
<!-- Button with Icon -->
<button class="bg-blue-600 text-white px-6 py-3 rounded-lg font-semibold hover:bg-blue-700 flex items-center gap-2 transition">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
</svg>
Add Item
</button>
<!-- Icon-only Button -->
<button class="bg-blue-600 text-white p-3 rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 transition">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
</svg>
</button>
<!-- Button Group -->
<div class="inline-flex rounded-lg shadow-sm">
<button class="px-4 py-2 text-sm font-medium text-gray-900 bg-white border border-gray-200 rounded-l-lg hover:bg-gray-100 focus:z-10 focus:ring-2 focus:ring-blue-500">
Left
</button>
<button class="px-4 py-2 text-sm font-medium text-gray-900 bg-white border-t border-b border-gray-200 hover:bg-gray-100 focus:z-10 focus:ring-2 focus:ring-blue-500">
Middle
</button>
<button class="px-4 py-2 text-sm font-medium text-gray-900 bg-white border border-gray-200 rounded-r-lg hover:bg-gray-100 focus:z-10 focus:ring-2 focus:ring-blue-500">
Right
</button>
</div>---
Modals and Dialogs
Modal
<!-- Modal Overlay -->
<div class="fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center p-4 z-50">
<!-- Modal Container -->
<div class="bg-white dark:bg-gray-800 rounded-2xl shadow-2xl max-w-md w-full overflow-hidden">
<!-- Modal Header -->
<div class="flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700">
<h3 class="text-xl font-semibold text-gray-900 dark:text-white">
Confirm Action
</h3>
<button class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<!-- Modal Body -->
<div class="p-6">
<p class="text-gray-600 dark:text-gray-400">
Are you sure you want to proceed with this action? This cannot be undone.
</p>
</div>
<!-- Modal Footer -->
<div class="flex justify-end gap-3 p-6 bg-gray-50 dark:bg-gray-900/50">
<button class="px-6 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg font-medium transition">
Cancel
</button>
<button class="px-6 py-2 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 transition">
Confirm
</button>
</div>
</div>
</div>---
Alerts and Notifications
Alert Variants
<!-- Success Alert -->
<div class="bg-green-50 dark:bg-green-900/20 border-l-4 border-green-500 p-4 rounded-r-lg">
<div class="flex items-start">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
</svg>
</div>
<div class="ml-3 flex-1">
<p class="text-sm font-medium text-green-800 dark:text-green-200">
Success! Your changes have been saved.
</p>
</div>
<button class="ml-3 text-green-500 hover:text-green-700 dark:hover:text-green-300">
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
<!-- Info Alert -->
<div class="bg-blue-50 dark:bg-blue-900/20 border-l-4 border-blue-500 p-4 rounded-r-lg">
<div class="flex items-start">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div class="ml-3 flex-1">
<p class="text-sm font-medium text-blue-800 dark:text-blue-200">
A new software update is available.
</p>
</div>
</div>
</div>
<!-- Warning Alert -->
<div class="bg-yellow-50 dark:bg-yellow-900/20 border-l-4 border-yellow-500 p-4 rounded-r-lg">
<div class="flex items-start">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-yellow-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
</div>
<div class="ml-3 flex-1">
<p class="text-sm font-medium text-yellow-800 dark:text-yellow-200">
Your session will expire in 5 minutes.
</p>
</div>
</div>
</div>
<!-- Error Alert -->
<div class="bg-red-50 dark:bg-red-900/20 border-l-4 border-red-500 p-4 rounded-r-lg">
<div class="flex items-start">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-red-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div class="ml-3 flex-1">
<p class="text-sm font-medium text-red-800 dark:text-red-200">
There was an error processing your request.
</p>
</div>
</div>
</div>Toast Notification
<!-- Toast Container (position fixed) -->
<div class="fixed bottom-4 right-4 max-w-sm w-full bg-white dark:bg-gray-800 rounded-lg shadow-2xl overflow-hidden z-50">
<div class="p-4">
<div class="flex items-start">
<div class="flex-shrink-0">
<div class="w-10 h-10 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center">
<svg class="w-6 h-6 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
</svg>
</div>
</div>
<div class="ml-3 flex-1">
<p class="text-sm font-medium text-gray-900 dark:text-white">
Successfully saved!
</p>
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">
Your changes have been saved successfully.
</p>
</div>
<button class="ml-4 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300">
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
<div class="h-1 bg-green-500"></div>
</div>---
Layout Patterns
Dashboard Layout
<div class="min-h-screen bg-gray-50 dark:bg-gray-900">
<!-- Sidebar (see sidebar navigation above) -->
<!-- Main Content -->
<main class="ml-64 p-8">
<!-- Stats Grid -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
<!-- Stat Card -->
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
<div class="flex items-center justify-between mb-2">
<span class="text-sm text-gray-600 dark:text-gray-400">Total Users</span>
<span class="text-green-500 text-sm font-semibold">+12%</span>
</div>
<p class="text-3xl font-bold text-gray-900 dark:text-white">24,563</p>
</div>
<!-- More stat cards... -->
</div>
<!-- Charts and Tables Section -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<!-- Chart Card -->
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">
Revenue Overview
</h3>
<div class="h-64 bg-gray-100 dark:bg-gray-700 rounded">
<!-- Chart goes here -->
</div>
</div>
<!-- Recent Activity -->
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">
Recent Activity
</h3>
<div class="space-y-4">
<!-- Activity items -->
</div>
</div>
</div>
</main>
</div>---
Tables
Data Table
<div class="bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
<thead class="bg-gray-50 dark:bg-gray-900">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
Name
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
Email
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
Status
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
Role
</th>
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
Actions
</th>
</tr>
</thead>
<tbody class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">
<tr class="hover:bg-gray-50 dark:hover:bg-gray-700 transition">
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<img class="h-10 w-10 rounded-full" src="/avatar1.jpg" alt="" />
<div class="ml-4">
<div class="text-sm font-medium text-gray-900 dark:text-white">
Jane Cooper
</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900 dark:text-gray-300">jane@example.com</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400">
Active
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">
Admin
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button class="text-blue-600 hover:text-blue-900 dark:hover:text-blue-400 mr-3">
Edit
</button>
<button class="text-red-600 hover:text-red-900 dark:hover:text-red-400">
Delete
</button>
</td>
</tr>
<!-- More rows... -->
</tbody>
</table>
</div>
<!-- Pagination -->
<div class="bg-gray-50 dark:bg-gray-900 px-6 py-4 flex items-center justify-between border-t border-gray-200 dark:border-gray-700">
<div class="text-sm text-gray-700 dark:text-gray-300">
Showing <span class="font-medium">1</span> to <span class="font-medium">10</span> of{' '}
<span class="font-medium">97</span> results
</div>
<div class="flex gap-2">
<button class="px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg text-sm font-medium hover:bg-gray-100 dark:hover:bg-gray-700 transition">
Previous
</button>
<button class="px-4 py-2 bg-blue-600 text-white rounded-lg text-sm font-medium hover:bg-blue-700 transition">
Next
</button>
</div>
</div>
</div>---
Lists
Task List
<div class="bg-white dark:bg-gray-800 rounded-lg shadow">
<div class="p-6 border-b border-gray-200 dark:border-gray-700">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white">Tasks</h3>
</div>
<ul class="divide-y divide-gray-200 dark:divide-gray-700">
<li class="p-4 hover:bg-gray-50 dark:hover:bg-gray-700 transition cursor-pointer">
<div class="flex items-center">
<input
type="checkbox"
class="h-5 w-5 text-blue-600 rounded focus:ring-2 focus:ring-blue-500"
/>
<div class="ml-3 flex-1">
<p class="text-sm font-medium text-gray-900 dark:text-white">
Complete project documentation
</p>
<p class="text-sm text-gray-500 dark:text-gray-400">Due today</p>
</div>
<span class="px-2 py-1 text-xs font-semibold rounded-full bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400">
High
</span>
</div>
</li>
<li class="p-4 hover:bg-gray-50 dark:hover:bg-gray-700 transition cursor-pointer">
<div class="flex items-center">
<input
type="checkbox"
checked
class="h-5 w-5 text-blue-600 rounded focus:ring-2 focus:ring-blue-500"
/>
<div class="ml-3 flex-1">
<p class="text-sm font-medium text-gray-500 dark:text-gray-400 line-through">
Review pull requests
</p>
<p class="text-sm text-gray-500 dark:text-gray-400">Completed</p>
</div>
<span class="px-2 py-1 text-xs font-semibold rounded-full bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400">
Medium
</span>
</div>
</li>
<!-- More tasks... -->
</ul>
</div>---
Avatars and Badges
Avatar Variations
<!-- Single Avatar -->
<img class="h-10 w-10 rounded-full" src="/avatar.jpg" alt="User" />
<!-- Avatar with Ring -->
<img class="h-10 w-10 rounded-full ring-2 ring-white dark:ring-gray-800" src="/avatar.jpg" alt="User" />
<!-- Avatar Stack -->
<div class="flex -space-x-2">
<img class="h-10 w-10 rounded-full ring-2 ring-white" src="/avatar1.jpg" alt="" />
<img class="h-10 w-10 rounded-full ring-2 ring-white" src="/avatar2.jpg" alt="" />
<img class="h-10 w-10 rounded-full ring-2 ring-white" src="/avatar3.jpg" alt="" />
<div class="h-10 w-10 rounded-full ring-2 ring-white bg-gray-200 flex items-center justify-center text-xs font-medium text-gray-600">
+99
</div>
</div>
<!-- Avatar with Status -->
<div class="relative">
<img class="h-10 w-10 rounded-full" src="/avatar.jpg" alt="User" />
<span class="absolute bottom-0 right-0 block h-3 w-3 rounded-full bg-green-500 ring-2 ring-white"></span>
</div>
<!-- Initials Avatar -->
<div class="h-10 w-10 rounded-full bg-blue-500 flex items-center justify-center text-white font-semibold">
JD
</div>Badges
<!-- Basic Badges -->
<span class="px-3 py-1 text-xs font-semibold rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400">
New
</span>
<!-- Status Badges -->
<span class="px-3 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800">Success</span>
<span class="px-3 py-1 text-xs font-semibold rounded-full bg-yellow-100 text-yellow-800">Warning</span>
<span class="px-3 py-1 text-xs font-semibold rounded-full bg-red-100 text-red-800">Error</span>
<span class="px-3 py-1 text-xs font-semibold rounded-full bg-gray-100 text-gray-800">Neutral</span>
<!-- Badge with Dot -->
<span class="inline-flex items-center gap-1.5 px-3 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800">
<span class="h-1.5 w-1.5 rounded-full bg-green-500"></span>
Active
</span>
<!-- Badge with Icon -->
<span class="inline-flex items-center gap-1 px-3 py-1 text-xs font-semibold rounded-full bg-blue-100 text-blue-800">
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
</svg>
Featured
</span>---
Loading States
Spinners
<!-- Simple Spinner -->
<svg class="animate-spin h-8 w-8 text-blue-600" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
<!-- Dots Loader -->
<div class="flex space-x-2">
<div class="h-3 w-3 bg-blue-600 rounded-full animate-bounce" style="animation-delay: 0ms"></div>
<div class="h-3 w-3 bg-blue-600 rounded-full animate-bounce" style="animation-delay: 150ms"></div>
<div class="h-3 w-3 bg-blue-600 rounded-full animate-bounce" style="animation-delay: 300ms"></div>
</div>
<!-- Pulse Loader -->
<div class="flex space-x-2">
<div class="h-3 w-3 bg-blue-600 rounded-full animate-pulse"></div>
<div class="h-3 w-3 bg-blue-600 rounded-full animate-pulse" style="animation-delay: 0.2s"></div>
<div class="h-3 w-3 bg-blue-600 rounded-full animate-pulse" style="animation-delay: 0.4s"></div>
</div>
<!-- Skeleton Loader -->
<div class="animate-pulse space-y-4">
<div class="h-4 bg-gray-200 dark:bg-gray-700 rounded w-3/4"></div>
<div class="h-4 bg-gray-200 dark:bg-gray-700 rounded"></div>
<div class="h-4 bg-gray-200 dark:bg-gray-700 rounded w-5/6"></div>
</div>---
These examples cover the most common UI patterns you'll need when building with Tailwind CSS. Each component is:
- Fully responsive
- Dark mode compatible
- Accessible (focus states, ARIA labels)
- Production-ready
- Customizable with Tailwind utilities
For more examples and advanced patterns, refer to:
- Official Tailwind UI: https://tailwindui.com
- Headless UI: https://headlessui.com
- Tailwind Components: https://tailwindcomponents.com
Tailwind CSS Skill
Master the utility-first CSS framework for rapidly building modern user interfaces.
Quick Start
Installation
With Vite (Recommended)
# Create new project
npm create vite@latest my-project
cd my-project
# Install Tailwind CSS
npm install tailwindcss @tailwindcss/vite// vite.config.ts
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [tailwindcss()],
})/* src/style.css */
@import "tailwindcss";<!-- index.html -->
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/src/style.css" rel="stylesheet">
</head>
<body>
<h1 class="text-3xl font-bold underline">
Hello, Tailwind CSS!
</h1>
</body>
</html>With CLI (No Build Tool)
# Install Tailwind CLI
npm install -D @tailwindcss/cli
# Create your CSS file
echo '@import "tailwindcss";' > src/input.css
# Start build process with watch mode
npx @tailwindcss/cli -i ./src/input.css -o ./src/output.css --watch<!-- Link compiled CSS in HTML -->
<link href="/src/output.css" rel="stylesheet">Framework-Specific Setup
Next.js
# Install dependencies
npm install tailwindcss @tailwindcss/vite/* app/globals.css */
@import "tailwindcss";// next.config.js
import tailwindcss from '@tailwindcss/vite'
export default {
experimental: {
vite: {
plugins: [tailwindcss()],
},
},
}React (Vite)
// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [tailwindcss(), react()],
})Vue / Nuxt
// nuxt.config.ts
import tailwindcss from "@tailwindcss/vite";
export default defineNuxtConfig({
vite: {
plugins: [tailwindcss()],
},
})Svelte / SvelteKit
// vite.config.ts
import { sveltekit } from '@sveltejs/kit/vite';
import tailwindcss from '@tailwindcss/vite';
export default {
plugins: [tailwindcss(), sveltekit()],
};Astro
// astro.config.mjs
import { defineConfig } from "astro/config";
import tailwindcss from "@tailwindcss/vite";
export default defineConfig({
vite: {
plugins: [tailwindcss()]
}
});Core Concepts
Utility-First Approach
Instead of writing custom CSS, compose utilities in your HTML:
<!-- Traditional CSS approach -->
<style>
.button {
background-color: blue;
color: white;
padding: 0.5rem 1rem;
border-radius: 0.25rem;
}
.button:hover {
background-color: darkblue;
}
</style>
<button class="button">Click me</button>
<!-- Tailwind utility-first approach -->
<button class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">
Click me
</button>Responsive Design
Mobile-first responsive design with breakpoint prefixes:
<!-- Stack on mobile, horizontal on tablet, 3 columns on desktop -->
<div class="flex flex-col md:flex-row lg:grid lg:grid-cols-3 gap-4">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
</div>State Variants
Apply styles for different states:
<button class="
bg-blue-500 text-white
hover:bg-blue-600
focus:outline-2 focus:outline-blue-400
active:bg-blue-700
disabled:opacity-50
">
Interactive Button
</button>Dark Mode
Automatic or manual dark mode support:
<div class="bg-white dark:bg-gray-900 text-gray-900 dark:text-white">
<p class="text-gray-600 dark:text-gray-400">
Content that adapts to dark mode
</p>
</div>Common Utilities Reference
Layout
<!-- Flexbox -->
<div class="flex items-center justify-between">...</div>
<!-- Grid -->
<div class="grid grid-cols-3 gap-4">...</div>
<!-- Positioning -->
<div class="relative">
<div class="absolute top-0 right-0">...</div>
</div>Spacing
<!-- Padding and margin -->
<div class="p-4 m-2">All sides</div>
<div class="px-4 py-2">Horizontal and vertical</div>
<div class="pt-8 pb-4 pl-6 pr-2">Individual sides</div>
<!-- Negative margins -->
<div class="-mt-4">Negative margin top</div>
<!-- Space between -->
<div class="flex space-x-4">Horizontal spacing</div>Typography
<!-- Font sizes -->
<p class="text-sm">Small text (0.875rem)</p>
<p class="text-base">Base text (1rem)</p>
<h1 class="text-4xl">Large heading (2.25rem)</h1>
<!-- Font weights -->
<p class="font-normal">Normal (400)</p>
<p class="font-semibold">Semibold (600)</p>
<p class="font-bold">Bold (700)</p>
<!-- Text colors -->
<p class="text-gray-900 dark:text-white">Primary text</p>
<p class="text-gray-600 dark:text-gray-400">Secondary text</p>Colors
<!-- Background -->
<div class="bg-blue-500">Solid background</div>
<div class="bg-blue-500/50">50% opacity</div>
<!-- Gradients -->
<div class="bg-gradient-to-r from-purple-500 to-pink-500">
Gradient background
</div>
<!-- Borders -->
<div class="border border-gray-300">Default border</div>
<div class="border-2 border-blue-500">Thick blue border</div>Effects
<!-- Shadows -->
<div class="shadow-md">Medium shadow</div>
<div class="shadow-lg">Large shadow</div>
<!-- Rounded corners -->
<div class="rounded">0.25rem radius</div>
<div class="rounded-lg">0.5rem radius</div>
<div class="rounded-full">Full circle/pill</div>
<!-- Opacity -->
<div class="opacity-50">50% opacity</div>
<div class="opacity-0 hover:opacity-100">Fade in on hover</div>Configuration
Custom Theme
/* app.css */
@import "tailwindcss";
@theme {
/* Custom colors */
--color-primary: #6366f1;
--color-secondary: #8b5cf6;
/* Custom spacing */
--spacing-18: 4.5rem;
/* Custom fonts */
--font-display: "Montserrat", sans-serif;
/* Custom breakpoints */
--breakpoint-xs: 30rem;
--breakpoint-3xl: 120rem;
}Custom Utilities
/* app.css */
@import "tailwindcss";
@utility content-auto {
content-visibility: auto;
}
@utility scrollbar-hidden {
&::-webkit-scrollbar {
display: none;
}
}Best Practices
1. Follow Mobile-First
Start with mobile styles, add breakpoints for larger screens:
<!-- Good: Mobile-first -->
<div class="w-full md:w-1/2 lg:w-1/3">
<!-- Avoid: Desktop-first -->
<div class="lg:w-1/3 md:w-1/2 w-full">2. Extract Components
For repeated patterns, create reusable components:
// React component
function Button({ children, variant = 'primary' }) {
const variants = {
primary: 'bg-blue-500 hover:bg-blue-600',
secondary: 'bg-gray-200 hover:bg-gray-300'
}
return (
<button className={`px-4 py-2 rounded ${variants[variant]}`}>
{children}
</button>
)
}3. Use Semantic HTML
Always use appropriate HTML elements:
<!-- Good -->
<article class="bg-white rounded-lg p-6">
<h2 class="text-2xl font-bold">Title</h2>
<p class="text-gray-600">Content</p>
</article>
<!-- Avoid -->
<div class="bg-white rounded-lg p-6">
<div class="text-2xl font-bold">Title</div>
<div class="text-gray-600">Content</div>
</div>4. Maintain Accessibility
Always include focus states and ARIA attributes:
<button
class="focus:outline-2 focus:outline-offset-2 focus:outline-blue-500"
aria-label="Close dialog"
>
<span class="sr-only">Close</span>
<svg>...</svg>
</button>5. Optimize for Production
- Configure content paths correctly
- Enable CSS minification
- Use JIT mode (default in v4)
- Remove unused custom utilities
Common Patterns
See EXAMPLES.md for complete component examples including:
- Navigation bars
- Hero sections
- Feature grids
- Cards
- Forms
- Modals
- Dropdowns
- And more...
Troubleshooting
Styles Not Applying
1. Check content configuration in CSS 2. Verify build process is running 3. Ensure no typos in class names 4. Check browser console for errors
Dark Mode Not Working
1. Verify dark variant configuration 2. Check if dark class is applied to <html> 3. Test system preference detection 4. Ensure dark styles are defined
Build Performance
1. Use JIT mode (default) 2. Optimize content paths 3. Remove unused dependencies 4. Enable caching
Resources
- Official Docs: https://tailwindcss.com
- Component Library: https://tailwindui.com
- Play CDN: https://play.tailwindcss.com
- GitHub: https://github.com/tailwindlabs/tailwindcss
- Discord Community: https://tailwindcss.com/discord
Learning Path
1. Start with SKILL.md for comprehensive concepts 2. Review EXAMPLES.md for practical component patterns 3. Build real projects to practice 4. Explore official plugins for advanced features 5. Customize theme for your brand 6. Optimize for production
Support
For issues or questions:
1. Check the official documentation 2. Search GitHub issues 3. Ask in Discord community 4. Review this skill's comprehensive guides
---
Version: 1.0.0 Last Updated: October 2025 Maintained by: Tailwind Labs