Massive training corpus for AI coding models containing: - 10 JSONL training datasets (641+ examples across coding, reasoning, planning, architecture, communication, debugging, security, workflows, error handling, UI/UX) - 11 agent behavior specifications (explorer, planner, reviewer, debugger, executor, UI designer, Linux admin, kernel engineer, security architect, automation engineer, API architect) - 6 skill definition files (coding, API engineering, kernel, Linux server, security architecture, server automation, UI/UX) - Master README with project origin story and philosophy Built by Pony Alpha 2 to help AI models learn expert-level coding approaches.
33 KiB
33 KiB
UI/UX Design Expert Skill
Activation Criteria
Activate this skill when the user:
- Requests creation of design systems or component libraries
- Asks for responsive layouts, mobile-first design, or cross-device interfaces
- Needs color schemes, typography pairing, or visual identity systems
- Requires accessibility compliance (WCAG 2.1, ARIA labels)
- Wants CSS/Tailwind implementations for UI components
- Requests Figma-to-code conversions or design token systems
- Needs dark mode implementation or theme switching
- Asks for animation, micro-interactions, or motion design
- Requires specific UI styles: glassmorphism, neumorphism, minimalism, brutalism
- Is building: web apps, dashboards, e-commerce sites, SaaS platforms, admin panels
- Needs CSS Grid, Flexbox, or modern layout mastery
Core Methodology
1. Design System Foundation
Step 1: Define Design Tokens
Start with atomic design tokens that form the foundation of all visual decisions.
/* Design Tokens - CSS Custom Properties */
:root {
/* Color Palette - Primary */
--color-primary-50: #eff6ff;
--color-primary-100: #dbeafe;
--color-primary-200: #bfdbfe;
--color-primary-300: #93c5fd;
--color-primary-400: #60a5fa;
--color-primary-500: #3b82f6;
--color-primary-600: #2563eb;
--color-primary-700: #1d4ed8;
--color-primary-800: #1e40af;
--color-primary-900: #1e3a8a;
/* Semantic Colors */
--color-success: #10b981;
--color-warning: #f59e0b;
--color-error: #ef4444;
--color-info: #3b82f6;
/* Neutral Scale */
--color-gray-50: #f9fafb;
--color-gray-100: #f3f4f6;
--color-gray-200: #e5e7eb;
--color-gray-300: #d1d5db;
--color-gray-400: #9ca3af;
--color-gray-500: #6b7280;
--color-gray-600: #4b5563;
--color-gray-700: #374151;
--color-gray-800: #1f2937;
--color-gray-900: #111827;
/* Typography Scale */
--font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
--font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
/* Font Sizes - Type Scale (Major Third) */
--text-xs: 0.75rem; /* 12px */
--text-sm: 0.875rem; /* 14px */
--text-base: 1rem; /* 16px */
--text-lg: 1.125rem; /* 18px */
--text-xl: 1.25rem; /* 20px */
--text-2xl: 1.5rem; /* 24px */
--text-3xl: 1.875rem; /* 30px */
--text-4xl: 2.25rem; /* 36px */
--text-5xl: 3rem; /* 48px */
/* Spacing Scale (4px base unit) */
--spacing-1: 0.25rem; /* 4px */
--spacing-2: 0.5rem; /* 8px */
--spacing-3: 0.75rem; /* 12px */
--spacing-4: 1rem; /* 16px */
--spacing-5: 1.25rem; /* 20px */
--spacing-6: 1.5rem; /* 24px */
--spacing-8: 2rem; /* 32px */
--spacing-10: 2.5rem; /* 40px */
--spacing-12: 3rem; /* 48px */
--spacing-16: 4rem; /* 64px */
--spacing-20: 5rem; /* 80px */
/* Border Radius */
--radius-sm: 0.25rem;
--radius-md: 0.375rem;
--radius-lg: 0.5rem;
--radius-xl: 0.75rem;
--radius-2xl: 1rem;
--radius-full: 9999px;
/* Shadows */
--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
/* Transitions */
--transition-fast: 150ms ease-in-out;
--transition-base: 200ms ease-in-out;
--transition-slow: 300ms ease-in-out;
/* Z-Index Scale */
--z-base: 0;
--z-dropdown: 1000;
--z-sticky: 1020;
--z-fixed: 1030;
--z-modal-backdrop: 1040;
--z-modal: 1050;
--z-popover: 1060;
--z-tooltip: 1070;
}
Tailwind Token Configuration
// tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
primary: {
50: '#eff6ff',
100: '#dbeafe',
200: '#bfdbfe',
300: '#93c5fd',
400: '#60a5fa',
500: '#3b82f6',
600: '#2563eb',
700: '#1d4ed8',
800: '#1e40af',
900: '#1e3a8a',
},
},
fontFamily: {
sans: ['Inter', 'system-ui', 'sans-serif'],
mono: ['Fira Code', 'monospace'],
},
spacing: {
'18': '4.5rem',
'88': '22rem',
'128': '32rem',
},
animation: {
'fade-in': 'fadeIn 0.2s ease-in-out',
'slide-up': 'slideUp 0.3s ease-out',
'slide-down': 'slideDown 0.3s ease-out',
'scale-in': 'scaleIn 0.2s ease-out',
},
keyframes: {
fadeIn: {
'0%': { opacity: '0' },
'100%': { opacity: '1' },
},
slideUp: {
'0%': { transform: 'translateY(10px)', opacity: '0' },
'100%': { transform: 'translateY(0)', opacity: '1' },
},
slideDown: {
'0%': { transform: 'translateY(-10px)', opacity: '0' },
'100%': { transform: 'translateY(0)', opacity: '1' },
},
scaleIn: {
'0%': { transform: 'scale(0.95)', opacity: '0' },
'100%': { transform: 'scale(1)', opacity: '1' },
},
},
},
},
plugins: [
require('@tailwindcss/forms'),
require('@tailwindcss/typography'),
require('@tailwindcss/aspect-ratio'),
],
};
2. Typography Systems
Font Pairing Strategy
Principle: Contrast without Conflict
/* Professional Pairing 1: Modern SaaS */
:root {
--font-heading: 'SF Pro Display', -apple-system, sans-serif;
--font-body: 'Inter', system-ui, sans-serif;
--font-mono: 'SF Mono', 'Fira Code', monospace;
}
/* Professional Pairing 2: Editorial */
:root {
--font-heading: 'Merriweather', Georgia, serif;
--font-body: 'Source Sans Pro', system-ui, sans-serif;
--font-mono: 'IBM Plex Mono', monospace;
}
/* Professional Pairing 3: Tech/Developer */
:root {
--font-heading: 'JetBrains Mono', monospace;
--font-body: 'Geist', 'SF Pro', system-ui, sans-serif;
--font-mono: 'Fira Code', monospace;
}
Typography Scale Implementation
/* Type Scale with Responsive Adjustments */
.heading-1 {
font-size: clamp(2.5rem, 5vw + 1rem, 4rem);
font-weight: 700;
line-height: 1.1;
letter-spacing: -0.02em;
}
.heading-2 {
font-size: clamp(2rem, 4vw + 0.5rem, 3rem);
font-weight: 600;
line-height: 1.2;
letter-spacing: -0.01em;
}
.heading-3 {
font-size: clamp(1.5rem, 2vw + 0.5rem, 2rem);
font-weight: 600;
line-height: 1.3;
}
.body-large {
font-size: 1.125rem;
line-height: 1.7;
}
.body-base {
font-size: 1rem;
line-height: 1.6;
}
.body-small {
font-size: 0.875rem;
line-height: 1.5;
}
.caption {
font-size: 0.75rem;
line-height: 1.4;
color: var(--color-gray-500);
}
Tailwind Typography Implementation
<!-- Using Tailwind's @apply for component patterns -->
<button class="btn-primary">
Button Text
</button>
<style>
@layer components {
.btn-primary {
@apply px-6 py-3 bg-primary-600 text-white font-semibold rounded-lg
shadow-md hover:bg-primary-700 focus:outline-none focus:ring-2
focus:ring-primary-500 focus:ring-offset-2
transition-colors duration-150;
}
}
</style>
3. Color System Design
Color Theory Application
Complementary Scheme for CTAs
/* High contrast for call-to-actions */
:root {
--color-action-primary: #2563eb; /* Blue */
--color-action-secondary: #10b981; /* Green complement */
}
Analogous Scheme for Navigation
/* Harmonious navigation colors */
:root {
--color-nav-base: #3b82f6;
--color-nav-hover: #60a5fa;
--color-nav-active: #2563eb;
}
Triadic Scheme for Status
/* Balanced status indicators */
:root {
--color-success: #10b981; /* Green */
--color-warning: #f59e0b; /* Orange */
--color-error: #ef4444; /* Red */
}
Dark Mode Implementation
/* Dark mode color mapping */
@media (prefers-color-scheme: dark) {
:root {
--color-bg-primary: #111827;
--color-bg-secondary: #1f2937;
--color-bg-tertiary: #374151;
--color-text-primary: #f9fafb;
--color-text-secondary: #d1d5db;
--color-text-tertiary: #9ca3af;
--color-border: #374151;
}
}
/* Manual dark mode toggle support */
[data-theme="dark"] {
--color-bg-primary: #111827;
--color-bg-secondary: #1f2937;
--color-text-primary: #f9fafb;
/* ... additional mappings */
}
[data-theme="light"] {
--color-bg-primary: #ffffff;
--color-bg-secondary: #f9fafb;
--color-text-primary: #111827;
/* ... additional mappings */
}
Tailwind Dark Mode Strategy
// tailwind.config.js
module.exports = {
darkMode: 'class', // or 'media'
theme: {
extend: {},
},
};
<!-- Implementation -->
<div class="bg-white dark:bg-gray-900 text-gray-900 dark:text-white">
<h1 class="text-2xl dark:text-gray-100">Adaptive Heading</h1>
<p class="text-gray-600 dark:text-gray-400">
Responsive to theme changes
</p>
</div>
4. Component Library Design
Button Component System
/* Base Button */
.button {
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--spacing-2);
padding: var(--spacing-3) var(--spacing-6);
font-size: var(--text-sm);
font-weight: 500;
line-height: 1;
border-radius: var(--radius-md);
border: 1px solid transparent;
cursor: pointer;
transition: all var(--transition-base);
}
/* Button Variants */
.button-primary {
background-color: var(--color-primary-600);
color: white;
box-shadow: var(--shadow-sm);
}
.button-primary:hover {
background-color: var(--color-primary-700);
box-shadow: var(--shadow-md);
}
.button-primary:active {
transform: translateY(1px);
}
.button-secondary {
background-color: white;
color: var(--color-gray-700);
border-color: var(--color-gray-300);
}
.button-secondary:hover {
background-color: var(--color-gray-50);
border-color: var(--color-gray-400);
}
.button-ghost {
background-color: transparent;
color: var(--color-gray-700);
}
.button-ghost:hover {
background-color: var(--color-gray-100);
}
/* Button Sizes */
.button-sm {
padding: var(--spacing-2) var(--spacing-4);
font-size: var(--text-xs);
}
.button-lg {
padding: var(--spacing-4) var(--spacing-8);
font-size: var(--text-base);
}
/* Button States */
.button:disabled {
opacity: 0.5;
cursor: not-allowed;
pointer-events: none;
}
.button-loading {
position: relative;
color: transparent;
}
.button-loading::after {
content: '';
position: absolute;
width: 1rem;
height: 1rem;
border: 2px solid currentColor;
border-top-color: transparent;
border-radius: 50%;
animation: spin 0.6s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
Tailwind Button Component
<!-- Primary Button -->
<button class="inline-flex items-center justify-center gap-2
px-6 py-3 text-sm font-medium text-white
bg-blue-600 rounded-lg shadow-sm
hover:bg-blue-700 hover:shadow-md
active:translate-y-px
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
disabled:opacity-50 disabled:cursor-not-allowed
transition-all duration-200">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
</svg>
Create New
</button>
<!-- Secondary Button -->
<button class="inline-flex items-center justify-center gap-2
px-6 py-3 text-sm font-medium text-gray-700
bg-white border border-gray-300 rounded-lg
hover:bg-gray-50 hover:border-gray-400
active:translate-y-px
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
transition-all duration-200">
Cancel
</button>
<!-- Ghost Button -->
<button class="inline-flex items-center justify-center gap-2
px-6 py-3 text-sm font-medium text-gray-700
bg-transparent rounded-lg
hover:bg-gray-100
active:translate-y-px
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
transition-all duration-200">
Learn More
</button>
Form Component System
/* Input Component */
.input {
width: 100%;
padding: var(--spacing-3) var(--spacing-4);
font-size: var(--text-base);
line-height: 1.5;
color: var(--color-gray-900);
background-color: white;
border: 1px solid var(--color-gray-300);
border-radius: var(--radius-md);
transition: all var(--transition-base);
}
.input:hover {
border-color: var(--color-gray-400);
}
.input:focus {
outline: none;
border-color: var(--color-primary-500);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.input:disabled {
background-color: var(--color-gray-100);
color: var(--color-gray-500);
cursor: not-allowed;
}
/* Error State */
.input-error {
border-color: var(--color-error);
}
.input-error:focus {
border-color: var(--color-error);
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
/* Input with Label */
.form-group {
display: flex;
flex-direction: column;
gap: var(--spacing-2);
}
.form-label {
font-size: var(--text-sm);
font-weight: 500;
color: var(--color-gray-700);
}
.form-label-required::after {
content: ' *';
color: var(--color-error);
}
.form-hint {
font-size: var(--text-xs);
color: var(--color-gray-500);
}
.form-error {
font-size: var(--text-xs);
color: var(--color-error);
}
Tailwind Form Components
<!-- Text Input -->
<div class="space-y-2">
<label for="email" class="block text-sm font-medium text-gray-700">
Email Address
</label>
<input
type="email"
id="email"
class="block w-full px-4 py-3 text-base text-gray-900
bg-white border border-gray-300 rounded-lg
hover:border-gray-400
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent
disabled:bg-gray-100 disabled:text-gray-500 disabled:cursor-not-allowed
transition-colors duration-200"
placeholder="you@example.com"
/>
<p class="text-xs text-gray-500">
We'll never share your email with anyone else.
</p>
</div>
<!-- Select Input -->
<div class="space-y-2">
<label for="country" class="block text-sm font-medium text-gray-700">
Country
</label>
<select
id="country"
class="block w-full px-4 py-3 text-base text-gray-900
bg-white border border-gray-300 rounded-lg
hover:border-gray-400
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent
transition-colors duration-200"
>
<option>United States</option>
<option>Canada</option>
<option>Mexico</option>
</select>
</div>
<!-- Checkbox -->
<div class="flex items-start gap-3">
<input
type="checkbox"
id="terms"
class="mt-1 w-4 h-4 text-blue-600 border-gray-300 rounded
focus:ring-2 focus:ring-blue-500"
/>
<label for="terms" class="text-sm text-gray-700">
I agree to the <a href="#" class="text-blue-600 hover:underline">Terms and Conditions</a>
</label>
</div>
5. Layout Systems
CSS Grid Mastery
/* Responsive Grid System */
.grid-container {
display: grid;
gap: var(--spacing-6);
}
/* Two Column Layout */
.grid-two {
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
/* Three Column Layout */
.grid-three {
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
/* Dashboard Grid */
.dashboard-grid {
display: grid;
grid-template-columns: 240px 1fr 300px;
grid-template-rows: auto 1fr auto;
grid-template-areas:
"header header header"
"sidebar main aside"
"footer footer footer";
min-height: 100vh;
gap: var(--spacing-6);
}
.dashboard-header { grid-area: header; }
.dashboard-sidebar { grid-area: sidebar; }
.dashboard-main { grid-area: main; }
.dashboard-aside { grid-area: aside; }
.dashboard-footer { grid-area: footer; }
/* Card Grid */
.card-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: var(--spacing-6);
}
@media (max-width: 768px) {
.dashboard-grid {
grid-template-columns: 1fr;
grid-template-areas:
"header"
"main"
"aside"
"sidebar"
"footer";
}
}
Tailwind Grid Implementation
<!-- Responsive Grid -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<div class="bg-white rounded-lg shadow-md p-6">Card 1</div>
<div class="bg-white rounded-lg shadow-md p-6">Card 2</div>
<div class="bg-white rounded-lg shadow-md p-6">Card 3</div>
</div>
<!-- Auto-fit Grid -->
<div class="grid grid-cols-[repeat(auto-fit,minmax(300px,1fr))] gap-6">
<!-- Cards -->
</div>
<!-- Complex Dashboard Layout -->
<div class="grid grid-cols-[240px_1fr_300px] grid-rows-[auto_1fr_auto] gap-6 min-h-screen">
<header class="col-span-3">Header</header>
<aside>Sidebar</aside>
<main>Main Content</main>
<aside>Aside</aside>
<footer class="col-span-3">Footer</footer>
</div>
Flexbox Patterns
/* Center Alignment */
.flex-center {
display: flex;
align-items: center;
justify-content: center;
}
/* Space Between */
.flex-space-between {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--spacing-4);
}
/* Vertical Stack */
.flex-stack {
display: flex;
flex-direction: column;
gap: var(--spacing-4);
}
/* Horizontal Scroll */
.flex-scroll {
display: flex;
gap: var(--spacing-4);
overflow-x: auto;
scroll-snap-type: x mandatory;
-webkit-overflow-scrolling: touch;
}
.flex-scroll > * {
scroll-snap-align: start;
flex-shrink: 0;
}
6. Responsive Design
Mobile-First Breakpoints
/* Mobile-First Breakpoint Scale */
/* Base: Mobile First (0px+) */
/* Small: 640px+ */
@media (min-width: 640px) {
.container {
max-width: 640px;
}
}
/* Medium: 768px+ */
@media (min-width: 768px) {
.container {
max-width: 768px;
}
}
/* Large: 1024px+ */
@media (min-width: 1024px) {
.container {
max-width: 1024px;
}
}
/* XLarge: 1280px+ */
@media (min-width: 1280px) {
.container {
max-width: 1280px;
}
}
/* 2XLarge: 1536px+ */
@media (min-width: 1536px) {
.container {
max-width: 1536px;
}
}
Tailwind Responsive Utilities
<!-- Responsive Typography -->
<h1 class="text-2xl sm:text-3xl md:text-4xl lg:text-5xl">
Responsive Heading
</h1>
<!-- Responsive Spacing -->
<div class="p-4 sm:p-6 md:p-8 lg:p-12">
Content
</div>
<!-- Responsive Grid -->
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
<!-- Cards -->
</div>
<!-- Hide/Show at Breakpoints -->
<div class="hidden md:block">
Desktop Only
</div>
<div class="block md:hidden">
Mobile Only
</div>
7. Design Styles
Glassmorphism
/* Glassmorphism Effect */
.glass {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: var(--radius-xl);
}
.glass-dark {
background: rgba(0, 0, 0, 0.2);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
}
/* Tailwind Implementation */
<div class="bg-white/10 backdrop-blur-md border border-white/20 rounded-2xl">
Glassmorphism Card
</div>
Neumorphism
/* Neumorphism (Soft UI) */
.neu-flat {
background: #e0e5ec;
border-radius: var(--radius-xl);
box-shadow:
20px 20px 60px #bebebe,
-20px -20px 60px #ffffff;
}
.neu-pressed {
background: #e0e5ec;
border-radius: var(--radius-xl);
box-shadow:
inset 20px 20px 60px #bebebe,
inset -20px -20px 60px #ffffff;
}
/* Tailwind Implementation */
<div class="bg-[#e0e5ec] rounded-2xl
shadow-[20px_20px_60px_#bebebe,-20px_-20px_60px_#ffffff]">
Neumorphic Element
</div>
Minimalism
/* Minimalist Design */
.minimal {
background: white;
border: none;
box-shadow: none;
padding: var(--spacing-6);
color: var(--color-gray-900);
}
.minimal-text {
font-family: var(--font-body);
font-weight: 400;
line-height: 1.6;
letter-spacing: 0;
}
Brutalism
/* Brutalist Design */
.brutalist {
background: var(--color-primary-600);
color: white;
border: 4px solid black;
box-shadow: 8px 8px 0 black;
padding: var(--spacing-6);
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.brutalist-button {
background: var(--color-warning);
border: 3px solid black;
box-shadow: 4px 4px 0 black;
transition: none;
}
.brutalist-button:hover {
transform: translate(2px, 2px);
box-shadow: 2px 2px 0 black;
}
.brutalist-button:active {
transform: translate(4px, 4px);
box-shadow: none;
}
/* Tailwind Implementation */
<button class="bg-yellow-500 text-black font-bold uppercase
border-4 border-black shadow-[8px_8px_0_#000]
hover:translate-x-1 hover:translate-y-1 hover:shadow-[6px_6px_0_#000]
active:translate-x-2 active:translate-y-2 active:shadow-none
transition-none">
Brutalist Button
</button>
8. Accessibility (WCAG 2.1)
Semantic HTML Structure
<!-- Proper Heading Hierarchy -->
<header>
<h1>Main Page Title</h1>
</header>
<main>
<section aria-labelledby="section-1-heading">
<h2 id="section-1-heading">Section Title</h2>
<article>
<h3>Article Title</h3>
<p>Article content...</p>
</article>
</section>
</main>
<nav aria-label="Main navigation">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
</ul>
</nav>
<footer>
<p>© 2024 Company</p>
</footer>
ARIA Labels and Roles
<!-- Accessible Buttons -->
<button aria-label="Close dialog" onclick="closeDialog()">
<svg aria-hidden="true" focusable="false">
<use xlink:href="#icon-x"/>
</svg>
</button>
<!-- Accessible Form Inputs -->
<label for="search">Search</label>
<input
type="search"
id="search"
name="search"
aria-describedby="search-hint"
/>
<span id="search-hint" class="sr-only">
Search for products by name or SKU
</span>
<!-- Accessible Dropdown -->
<div class="dropdown">
<button
id="menu-button"
aria-haspopup="true"
aria-expanded="false"
aria-controls="menu-list"
>
Options
</button>
<ul
id="menu-list"
role="menu"
aria-labelledby="menu-button"
>
<li role="none">
<a role="menuitem" href="/option1">Option 1</a>
</li>
</ul>
</div>
<!-- Screen Reader Only -->
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
Keyboard Navigation
/* Focus Visible Indicator */
*:focus-visible {
outline: 2px solid var(--color-primary-600);
outline-offset: 2px;
}
/* Skip Link */
.skip-link {
position: absolute;
top: -40px;
left: 0;
background: var(--color-primary-600);
color: white;
padding: var(--spacing-2) var(--spacing-4);
z-index: 9999;
}
.skip-link:focus {
top: 0;
}
/* Tab Order */
.tab-trigger {
cursor: pointer;
}
.tab-trigger[aria-selected="true"] {
background: var(--color-primary-600);
color: white;
}
Color Contrast Standards
/* Minimum Contrast Ratios (WCAG 2.1) */
/* AA: 4.5:1 for normal text, 3:1 for large text */
/* AAA: 7:1 for normal text, 4.5:1 for large text */
/* Example - Pass AA */
.text-primary {
color: #2563eb; /* On white: 7.5:1 */
}
.text-secondary {
color: #4b5563; /* On white: 5.74:1 */
}
/* Example - Fail AA */
.text-fail {
color: #9ca3af; /* On white: 2.85:1 - FAIL */
}
9. Animation Principles
Micro-interactions
/* Hover Animation */
.hover-lift {
transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.hover-lift:hover {
transform: translateY(-4px);
box-shadow: var(--shadow-lg);
}
/* Focus Animation */
.focus-ring {
transition: box-shadow var(--transition-base);
}
.focus-ring:focus {
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}
/* Loading Animation */
.spinner {
width: 40px;
height: 40px;
border: 4px solid var(--color-gray-200);
border-top-color: var(--color-primary-600);
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* Pulse Animation */
.pulse {
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
Tailwind Animations
<!-- Fade In -->
<div class="animate-fade-in">
Content fades in
</div>
<!-- Slide Up -->
<div class="animate-slide-up">
Content slides up
</div>
<!-- Custom Animation -->
<div class="hover:scale-105 transition-transform duration-200">
Hover to scale
</div>
<!-- Loading Spinner -->
<div class="w-10 h-10 border-4 border-gray-200 border-t-blue-600 rounded-full animate-spin">
</div>
10. Design Patterns
Card Component
.card {
background: white;
border-radius: var(--radius-lg);
box-shadow: var(--shadow-md);
padding: var(--spacing-6);
transition: all var(--transition-base);
}
.card:hover {
box-shadow: var(--shadow-lg);
transform: translateY(-2px);
}
.card-header {
display: flex;
align-items: center;
gap: var(--spacing-4);
margin-bottom: var(--spacing-4);
}
.card-title {
font-size: var(--text-lg);
font-weight: 600;
color: var(--color-gray-900);
}
.card-body {
color: var(--color-gray-600);
line-height: 1.6;
}
.card-footer {
display: flex;
gap: var(--spacing-2);
margin-top: var(--spacing-6);
}
Modal Component
.modal-backdrop {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(4px);
z-index: var(--z-modal-backdrop);
animation: fadeIn 0.2s ease-out;
}
.modal {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: white;
border-radius: var(--radius-xl);
box-shadow: var(--shadow-xl);
z-index: var(--z-modal);
max-width: 500px;
width: 90%;
max-height: 90vh;
overflow: auto;
animation: scaleIn 0.2s ease-out;
}
.modal-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--spacing-6);
border-bottom: 1px solid var(--color-gray-200);
}
.modal-body {
padding: var(--spacing-6);
}
.modal-footer {
display: flex;
gap: var(--spacing-3);
justify-content: flex-end;
padding: var(--spacing-6);
border-top: 1px solid var(--color-gray-200);
}
Navigation Component
.navbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--spacing-4) var(--spacing-6);
background: white;
border-bottom: 1px solid var(--color-gray-200);
position: sticky;
top: 0;
z-index: var(--z-sticky);
}
.navbar-brand {
font-size: var(--text-xl);
font-weight: 700;
color: var(--color-primary-600);
}
.navbar-menu {
display: flex;
gap: var(--spacing-6);
}
.navbar-link {
color: var(--color-gray-600);
text-decoration: none;
font-weight: 500;
transition: color var(--transition-fast);
}
.navbar-link:hover,
.navbar-link.active {
color: var(--color-primary-600);
}
11. Dashboard Design
Dashboard Layout Pattern
.dashboard {
display: grid;
grid-template-columns: 260px 1fr;
min-height: 100vh;
}
.dashboard-sidebar {
background: var(--color-gray-900);
color: white;
padding: var(--spacing-6);
}
.dashboard-main {
background: var(--color-gray-50);
padding: var(--spacing-6);
}
.stat-card {
background: white;
padding: var(--spacing-6);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-sm);
}
.stat-value {
font-size: var(--text-3xl);
font-weight: 700;
color: var(--color-gray-900);
}
.stat-label {
font-size: var(--text-sm);
color: var(--color-gray-600);
margin-top: var(--spacing-2);
}
Tailwind Dashboard
<div class="flex min-h-screen">
<!-- Sidebar -->
<aside class="w-64 bg-gray-900 text-white p-6">
<div class="text-xl font-bold mb-8">Dashboard</div>
<nav class="space-y-2">
<a href="#" class="block px-4 py-2 rounded-lg bg-blue-600">Overview</a>
<a href="#" class="block px-4 py-2 rounded-lg hover:bg-gray-800">Analytics</a>
<a href="#" class="block px-4 py-2 rounded-lg hover:bg-gray-800">Settings</a>
</nav>
</aside>
<!-- Main Content -->
<main class="flex-1 bg-gray-50 p-6">
<!-- Stats Grid -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
<div class="bg-white p-6 rounded-lg shadow-sm">
<div class="text-3xl font-bold text-gray-900">1,234</div>
<div class="text-sm text-gray-600 mt-2">Total Users</div>
</div>
<!-- More stats -->
</div>
</main>
</div>
12. E-commerce Design
Product Card Pattern
.product-card {
background: white;
border-radius: var(--radius-lg);
box-shadow: var(--shadow-sm);
overflow: hidden;
transition: all var(--transition-base);
}
.product-card:hover {
box-shadow: var(--shadow-lg);
transform: translateY(-4px);
}
.product-image {
width: 100%;
aspect-ratio: 1;
object-fit: cover;
}
.product-info {
padding: var(--spacing-4);
}
.product-name {
font-size: var(--text-base);
font-weight: 600;
color: var(--color-gray-900);
margin-bottom: var(--spacing-2);
}
.product-price {
font-size: var(--text-lg);
font-weight: 700;
color: var(--color-primary-600);
}
.product-button {
width: 100%;
margin-top: var(--spacing-4);
}
13. Decision Trees
Layout Selection
Need to arrange content?
│
├─ Single column? → Flex column
├─ Two columns? → Grid 2 cols
├─ Three+ columns? → Grid auto-fit
├─ Complex dashboard? → Grid with named areas
└─ Horizontal scroll? → Flex with overflow
Component Style Selection
What's the product type?
│
├─ SaaS/B2B → Minimalism, clean borders
├─ E-commerce → Card-based, clear CTAs
├─ Creative portfolio → Glassmorphism, bold colors
├─ Developer tools → Brutalism, monospace
└─ Healthcare → Clean, high contrast, accessible
Color Scheme Selection
What's the brand personality?
│
├─ Trustworthy → Blue primary
├─ Energetic → Orange/Yellow primary
├─ Natural → Green primary
├─ Luxury → Black/Gold or Purple
└─ Playful → Multicolor, gradients
14. Anti-Patterns to Avoid
- Magic Numbers: Never use arbitrary pixel values. Use spacing scale.
- Hard-coded Colors: Never use hex codes directly. Use design tokens.
- Missing Focus States: Always provide keyboard navigation indicators.
- Poor Contrast: Always test contrast ratios (minimum 4.5:1).
- Infinite Scrolling without Pagination: Provide alternative navigation.
- Tiny Touch Targets: Buttons minimum 44x44px for mobile.
- Missing Loading States: Always provide feedback for async actions.
- Inconsistent Spacing: Use spacing scale consistently.
- Overriding Accessibility: Never remove native accessibility features.
- Blocking Mobile: Always design mobile-first.
15. Quality Checklist
Before delivery, verify:
- All colors use design tokens (no hardcoded hex)
- Typography follows type scale
- Spacing uses spacing scale
- All interactive elements have hover/focus/active states
- All images have alt text or are decorative
- Color contrast meets WCAG AA (4.5:1 minimum)
- Keyboard navigation works for all interactive elements
- Focus indicators are visible
- Forms have proper labels and error messages
- Loading states provided for async actions
- Responsive design tested on mobile/tablet/desktop
- Dark mode preserves contrast and readability
- Animations have
prefers-reduced-motionsupport - Touch targets minimum 44x44px on mobile
- Semantic HTML used (headings, landmarks, lists)
- ARIA labels provided where needed
- Z-index follows defined scale
- Border radius consistent within component
- Shadows follow defined scale
- Transitions follow timing standards
16. Quick Reference
Tailwind Common Patterns
<!-- Container -->
<div class="container mx-auto px-4 max-w-7xl">
<!-- Flex Center -->
<div class="flex items-center justify-center">
<!-- Grid Responsive -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- Card -->
<div class="bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow">
<!-- Button Primary -->
<button class="px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 focus:ring-2 focus:ring-blue-500">
<!-- Input -->
<input class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent">
<!-- Modal Backdrop -->
<div class="fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center">
<!-- Responsive Hide/Show -->
<div class="hidden md:block">Desktop only</div>
This comprehensive skill definition provides complete guidance for UI/UX design across modern web applications, with real code examples for every pattern.