Loading...
Loading...
Expert guidance for creating stunning, professional 2025 UI designs using Tailwind CSS and shadcn/ui. Ensures clean minimal aesthetics, 8px grid consistency, mobile-first responsive patterns, and WCAG accessibility compliance. Use when designing interfaces, reviewing UI, creating components, or when visual design needs modern professional standards.
npx skill4agent add sitechfromgeorgia/georgian-distribution-system modern-ui-designer0 → 0px
0.5 → 2px (exception for borders)
1 → 4px (half unit)
2 → 8px (base)
3 → 12px (1.5 units, use sparingly)
4 → 16px (2 units)
5 → 20px (2.5 units, use sparingly)
6 → 24px (3 units)
8 → 32px (4 units)
10 → 40px (5 units)
12 → 48px (6 units)
16 → 64px (8 units)
20 → 80px (10 units)
24 → 96px (12 units)
32 → 128px (16 units)<div class="space-y-2">
<h3 class="text-xl font-semibold">Heading</h3>
<p class="text-gray-600">Subheading</p>
</div><div class="space-y-6">
<section><!-- Content --></section>
<section><!-- Content --></section>
</div><div class="space-y-12 md:space-y-16">
<section><!-- Major section --></section>
<section><!-- Major section --></section>
</div>slate-50 → Backgrounds
slate-100 → Subtle backgrounds
slate-200 → Borders, dividers
slate-300 → Disabled text
slate-400 → Placeholder text
slate-500 → Secondary text
slate-600 → Body text
slate-700 → Headings
slate-800 → Emphasis
slate-900 → Maximum contrast<!-- Success -->
<div class="bg-green-50 text-green-700 border border-green-200">
<!-- Warning -->
<div class="bg-yellow-50 text-yellow-800 border border-yellow-200">
<!-- Error -->
<div class="bg-red-50 text-red-700 border border-red-200">
<!-- Info -->
<div class="bg-blue-50 text-blue-700 border border-blue-200"><!-- Neutral backgrounds -->
<div class="bg-white dark:bg-slate-900 text-slate-900 dark:text-slate-50">
<!-- Borders -->
<div class="border border-slate-200 dark:border-slate-800">
<!-- Subtle backgrounds -->
<div class="bg-slate-50 dark:bg-slate-800">
<!-- Primary accent -->
<button class="bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600">✅ slate-900 on white → 18.9:1
✅ slate-700 on white → 8.6:1
✅ slate-600 on white → 6.2:1
✅ blue-600 on white → 5.4:1
❌ slate-400 on white → 2.9:1 (fails)
❌ slate-300 on white → 1.7:1 (fails)<!-- ✅ Compose utilities directly -->
<button class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
transition-colors duration-200">
Click me
</button>/* ❌ Avoid custom CSS unless absolutely necessary */
.custom-button {
padding: 0.5rem 1rem;
background: #3b82f6;
/* ... */
}/* ✅ Good use of @apply */
@layer components {
.btn-primary {
@apply px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700
focus:outline-none focus:ring-2 focus:ring-blue-500;
}
}sm: 640px → Small tablets
md: 768px → Tablets
lg: 1024px → Desktop
xl: 1280px → Large desktop
2xl: 1536px → Extra large<!-- Mobile first, then scale up -->
<div class="p-4 md:p-6 lg:p-8">
<h1 class="text-2xl md:text-3xl lg:text-4xl">
Responsive Heading
</h1>
</div>
<!-- Grid responsive -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-6">
<!-- Items -->
</div><button class="bg-blue-600 hover:bg-blue-700 active:bg-blue-800
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
disabled:opacity-50 disabled:cursor-not-allowed"><div class="bg-white dark:bg-slate-900
text-slate-900 dark:text-slate-50
border border-slate-200 dark:border-slate-800"><!-- ✅ Organized -->
<div class="
flex items-center justify-between
w-full max-w-screen-lg
px-4 py-3 my-2
text-lg font-medium text-gray-800
bg-white rounded shadow
hover:shadow-md
transition-shadow
">// tailwind.config.js
module.exports = {
content: [
'./src/**/*.{html,js,jsx,ts,tsx}',
'./components/**/*.{html,js,jsx,ts,tsx}',
],
// ... rest of config
}w-[373px]// Button.tsx
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const buttonVariants = cva(
// Base styles (always applied)
"inline-flex items-center justify-center rounded-lg font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
default: "bg-slate-900 text-slate-50 hover:bg-slate-800",
outline: "border border-slate-200 bg-transparent hover:bg-slate-100",
ghost: "hover:bg-slate-100",
},
size: {
sm: "h-8 px-3 text-sm",
md: "h-10 px-4",
lg: "h-12 px-6 text-lg",
},
},
defaultVariants: {
variant: "default",
size: "md",
},
}
)
interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {}
export const Button = ({ className, variant, size, ...props }: ButtonProps) => {
return (
<button
className={cn(buttonVariants({ variant, size }), className)}
{...props}
/>
)
}cn()import { cn } from "@/lib/utils"
// Allows className override
<Button className={cn("custom-class", conditionalClass && "other-class")} />// tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
border: "hsl(var(--border))",
input: "hsl(var(--input))",
ring: "hsl(var(--ring))",
background: "hsl(var(--background))",
foreground: "hsl(var(--foreground))",
primary: {
DEFAULT: "hsl(var(--primary))",
foreground: "hsl(var(--primary-foreground))",
},
// ... more design tokens
},
},
},
}:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--primary: 221.2 83.2% 53.3%;
--primary-foreground: 210 40% 98%;
--border: 214.3 31.8% 91.4%;
--radius: 0.5rem;
}
.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
--primary: 217.2 91.2% 59.8%;
--primary-foreground: 222.2 47.4% 11.2%;
--border: 217.2 32.6% 17.5%;
}<div className="space-y-2">
<Label htmlFor="email">Email</Label>
<Input
id="email"
type="email"
placeholder="you@example.com"
className="w-full"
/>
<p className="text-sm text-slate-500">
We'll never share your email.
</p>
</div><Card>
<CardHeader>
<CardTitle>Card Title</CardTitle>
<CardDescription>Card description goes here</CardDescription>
</CardHeader>
<CardContent>
<!-- Main content -->
</CardContent>
<CardFooter>
<!-- Actions -->
</CardFooter>
</Card><Dialog>
<DialogTrigger asChild>
<Button variant="outline">Open Dialog</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Dialog Title</DialogTitle>
<DialogDescription>
Dialog description text
</DialogDescription>
</DialogHeader>
<!-- Dialog content -->
<DialogFooter>
<Button variant="outline">Cancel</Button>
<Button>Confirm</Button>
</DialogFooter>
</DialogContent>
</Dialog><!-- ✅ Proper focus management -->
<button
class="focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
>
Accessible Button
</button>
<!-- ✅ Skip links -->
<a href="#main-content" class="sr-only focus:not-sr-only focus:absolute focus:top-0 focus:left-0">
Skip to main content
</a>focus:ring-2focus:ring-offset-2min-h-[44px] min-w-[44px]<!-- ✅ Good contrast -->
<p class="text-slate-700">Body text</p> <!-- 8.6:1 -->
<button class="bg-blue-600 text-white">Action</button> <!-- 5.4:1 -->
<!-- ❌ Poor contrast -->
<p class="text-slate-400">Fails WCAG</p> <!-- 2.9:1 --><!-- ✅ Use proper semantic elements -->
<header>
<nav aria-label="Main navigation">
<ul>
<li><a href="/">Home</a></li>
</ul>
</nav>
</header>
<main>
<article>
<h1>Page Title</h1>
<section>
<h2>Section Heading</h2>
<!-- Content -->
</section>
</article>
</main>
<footer>
<!-- Footer content -->
</footer><!-- Icon-only buttons -->
<button aria-label="Close dialog" class="...">
<XIcon className="h-4 w-4" aria-hidden="true" />
</button>
<!-- Form labels -->
<label for="search" class="sr-only">Search</label>
<input id="search" type="search" />
<!-- Live regions -->
<div role="status" aria-live="polite" aria-atomic="true">
Loading...
</div><form>
<div>
<label for="email" class="block text-sm font-medium mb-2">
Email
<span class="text-red-600" aria-label="required">*</span>
</label>
<input
id="email"
type="email"
required
aria-required="true"
aria-describedby="email-error"
aria-invalid={hasError ? "true" : "false"}
class="w-full"
/>
{hasError && (
<p id="email-error" class="text-sm text-red-600 mt-1" role="alert">
Please enter a valid email address
</p>
)}
</div>
</form><!-- Responsive container -->
<div class="container mx-auto px-4 md:px-6 lg:px-8 max-w-7xl">
<!-- Content -->
</div><!-- Responsive text -->
<h1 class="text-3xl md:text-4xl lg:text-5xl font-bold">
Responsive Heading
</h1>
<p class="text-base md:text-lg leading-relaxed">
Body text with responsive sizing
</p><!-- Responsive grid -->
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 lg:gap-6">
<div><!-- Card --></div>
<div><!-- Card --></div>
<div><!-- Card --></div>
</div><!-- Stack on mobile, row on desktop -->
<div class="flex flex-col md:flex-row gap-4 md:gap-6">
<div class="flex-1"><!-- Content --></div>
<div class="flex-1"><!-- Content --></div>
</div><!-- Hide on mobile, show on desktop -->
<div class="hidden md:block">
Desktop only content
</div>
<!-- Show on mobile, hide on desktop -->
<div class="block md:hidden">
Mobile only content
</div><!-- Mobile: Hamburger menu -->
<!-- Desktop: Horizontal nav -->
<nav>
<!-- Mobile menu button -->
<button class="md:hidden">
<MenuIcon />
</button>
<!-- Desktop nav -->
<ul class="hidden md:flex md:space-x-4">
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
</ul>
</nav>// tailwind.config.js
module.exports = {
theme: {
extend: {
fontFamily: {
sans: ['Inter', 'system-ui', 'sans-serif'],
mono: ['JetBrains Mono', 'monospace'],
},
},
},
}text-xs → 12px (line-height: 16px)
text-sm → 14px (line-height: 20px)
text-base → 16px (line-height: 24px) ← Body text default
text-lg → 18px (line-height: 28px)
text-xl → 20px (line-height: 28px)
text-2xl → 24px (line-height: 32px)
text-3xl → 30px (line-height: 36px)
text-4xl → 36px (line-height: 40px)
text-5xl → 48px (line-height: 48px)
text-6xl → 60px (line-height: 60px)<!-- Body text -->
<p class="text-base leading-6"> <!-- 16px text, 24px line-height -->
<!-- Headings -->
<h2 class="text-3xl leading-9"> <!-- 30px text, 36px line-height --><article class="space-y-6">
<!-- Main heading -->
<h1 class="text-4xl md:text-5xl font-bold text-slate-900 leading-tight">
Article Title
</h1>
<!-- Subtitle -->
<p class="text-xl text-slate-600 leading-relaxed">
Engaging subtitle or description
</p>
<!-- Meta information -->
<div class="flex items-center gap-4 text-sm text-slate-500">
<span>By Author Name</span>
<span>•</span>
<time datetime="2025-01-15">Jan 15, 2025</time>
</div>
<!-- Body content -->
<div class="prose prose-slate max-w-none">
<p class="text-base leading-relaxed text-slate-700">
Body paragraph with comfortable reading size and spacing...
</p>
</div>
</article><!-- Subtle card elevation -->
<div class="shadow-sm"> <!-- Very subtle -->
<div class="shadow"> <!-- Default card -->
<div class="shadow-md"> <!-- Slightly raised -->
<div class="shadow-lg"> <!-- Pronounced elevation -->
<div class="shadow-xl"> <!-- Modal/dialog -->
<!-- Custom shadows (use sparingly) -->
<div class="shadow-[0_2px_8px_rgba(0,0,0,0.08)]"><div class="border border-slate-200 shadow-sm rounded-lg">
<!-- More refined than shadow alone -->
</div><!-- Card hover effect -->
<div class="border border-slate-200 shadow-sm hover:shadow-md
transition-shadow duration-200 rounded-lg">
Hover me
</div>rounded-none → 0px
rounded-sm → 2px (subtle, modern)
rounded → 4px (default)
rounded-md → 6px (cards)
rounded-lg → 8px (buttons, inputs) ← Preferred
rounded-xl → 12px (large cards)
rounded-2xl → 16px (hero sections)
rounded-full → 9999px (circles, pills)<!-- Modern button -->
<button class="px-4 py-2 bg-blue-600 text-white rounded-lg">
<!-- Card -->
<div class="border border-slate-200 rounded-xl p-6">
<!-- Avatar -->
<img class="h-10 w-10 rounded-full" /><!-- Primary -->
<button class="
inline-flex items-center justify-center
h-10 px-4
text-base font-medium
bg-blue-600 text-white
rounded-lg
hover:bg-blue-700
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
active:bg-blue-800
disabled:opacity-50 disabled:cursor-not-allowed
transition-colors duration-200
">
Primary Action
</button>
<!-- Secondary -->
<button class="
inline-flex items-center justify-center
h-10 px-4
text-base font-medium
border border-slate-300 bg-white text-slate-700
rounded-lg
hover:bg-slate-50
focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2
disabled:opacity-50 disabled:cursor-not-allowed
transition-colors duration-200
">
Secondary Action
</button>
<!-- Ghost -->
<button class="
inline-flex items-center justify-center
h-10 px-4
text-base font-medium text-slate-700
rounded-lg
hover:bg-slate-100
focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2
transition-colors duration-200
">
Ghost Button
</button><div class="space-y-2">
<label
for="email"
class="block text-sm font-medium text-slate-700"
>
Email address
</label>
<input
id="email"
type="email"
placeholder="you@example.com"
class="
w-full h-10 px-3
text-base text-slate-900 placeholder:text-slate-400
bg-white
border border-slate-300 rounded-lg
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent
disabled:bg-slate-50 disabled:text-slate-500 disabled:cursor-not-allowed
transition-colors duration-200
"
/>
<p class="text-sm text-slate-500">
We'll never share your email with anyone else.
</p>
</div><div class="
bg-white
border border-slate-200
rounded-xl
shadow-sm hover:shadow-md
transition-shadow duration-200
overflow-hidden
">
<!-- Card header with image -->
<div class="aspect-video bg-slate-100">
<img
src="..."
alt="..."
class="w-full h-full object-cover"
/>
</div>
<!-- Card content -->
<div class="p-6 space-y-4">
<!-- Heading -->
<h3 class="text-xl font-semibold text-slate-900">
Card Title
</h3>
<!-- Description -->
<p class="text-base text-slate-600 leading-relaxed">
Card description goes here with comfortable reading spacing.
</p>
<!-- Actions -->
<div class="flex items-center gap-3">
<button class="...">Primary</button>
<button class="...">Secondary</button>
</div>
</div>
</div><header class="sticky top-0 z-50 bg-white border-b border-slate-200">
<nav class="container mx-auto px-4 md:px-6">
<div class="flex items-center justify-between h-16">
<!-- Logo -->
<a href="/" class="flex items-center gap-2">
<img src="logo.svg" alt="Logo" class="h-8 w-8" />
<span class="text-xl font-bold text-slate-900">Brand</span>
</a>
<!-- Desktop navigation -->
<ul class="hidden md:flex items-center gap-8">
<li>
<a href="/" class="text-sm font-medium text-slate-700 hover:text-slate-900">
Home
</a>
</li>
<li>
<a href="/about" class="text-sm font-medium text-slate-700 hover:text-slate-900">
About
</a>
</li>
<li>
<a href="/contact" class="text-sm font-medium text-slate-700 hover:text-slate-900">
Contact
</a>
</li>
</ul>
<!-- CTA -->
<button class="hidden md:inline-flex ...">
Get Started
</button>
<!-- Mobile menu button -->
<button class="md:hidden" aria-label="Open menu">
<MenuIcon class="h-6 w-6" />
</button>
</div>
</nav>
</header><!-- ❌ Bad: Random spacing values -->
<div class="mt-3 mb-5 px-7">
<!-- ✅ Good: 8px grid aligned -->
<div class="my-4 px-6"><!-- ❌ Bad: Fails WCAG -->
<p class="text-slate-400">Important text</p>
<!-- ✅ Good: Passes WCAG -->
<p class="text-slate-700">Important text</p><!-- ❌ Bad: No focus indicator -->
<button class="outline-none">
<!-- ✅ Good: Clear focus ring -->
<button class="focus:outline-none focus:ring-2 focus:ring-blue-500"><!-- ❌ Bad: Divs for everything -->
<div onClick="navigate()">Home</div>
<!-- ✅ Good: Semantic elements -->
<a href="/home">Home</a><!-- ❌ Bad: Too small for touch -->
<button class="p-1">×</button>
<!-- ✅ Good: Minimum 44x44px -->
<button class="p-3 min-h-[44px] min-w-[44px]">×</button><!-- ❌ Bad: Rainbow chaos -->
<div class="bg-gradient-to-r from-purple-500 via-pink-500 to-red-500
shadow-2xl border-4 border-yellow-400 rounded-3xl">
<!-- ✅ Good: Minimal & professional -->
<div class="bg-white border border-slate-200 rounded-lg shadow-sm"><!-- ❌ Bad: Breaks on small screens -->
<div class="w-[800px]">
<!-- ✅ Good: Responsive -->
<div class="w-full max-w-3xl">@layer base {
:root {
/* Spacing */
--spacing-xs: 0.5rem; /* 8px */
--spacing-sm: 1rem; /* 16px */
--spacing-md: 1.5rem; /* 24px */
--spacing-lg: 2rem; /* 32px */
/* Colors */
--color-primary: 220 90% 56%;
--color-primary-hover: 220 90% 48%;
/* Border radius */
--radius-sm: 0.5rem; /* 8px */
--radius-md: 0.75rem; /* 12px */
--radius-lg: 1rem; /* 16px */
}
}@layer utilities {
/* Text balance for headings */
.text-balance {
text-wrap: balance;
}
/* Smooth scroll */
.scroll-smooth {
scroll-behavior: smooth;
}
/* Focus visible only */
.focus-visible-ring {
@apply focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500;
}
}// Compose smaller components into larger ones
<Card>
<CardHeader>
<div className="flex items-center justify-between">
<div className="space-y-1">
<CardTitle>Dashboard</CardTitle>
<CardDescription>Welcome back</CardDescription>
</div>
<Button variant="outline" size="sm">
<SettingsIcon className="h-4 w-4" />
</Button>
</div>
</CardHeader>
<CardContent>
<Tabs defaultValue="overview">
<TabsList>
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="analytics">Analytics</TabsTrigger>
</TabsList>
<TabsContent value="overview" className="space-y-4">
{/* Content */}
</TabsContent>
</Tabs>
</CardContent>
</Card>