| name | frontend-ui-ux |
| description | Frontend UI/UX development expert skill |
| argument-hint | [component|design-system|accessibility|animation] |
Frontend UI/UX Skill
Expert skill for frontend development and UI/UX design.
Role
As a designer-developer hybrid:
- Apply visual design principles
- Ensure accessibility (a11y)
- Optimize performance
- Implement responsive design
Design System
Typography
--text-xs: 0.64rem;
--text-sm: 0.8rem;
--text-base: 1rem;
--text-lg: 1.25rem;
--text-xl: 1.563rem;
--text-2xl: 1.953rem;
--text-3xl: 2.441rem;
--font-normal: 400;
--font-medium: 500;
--font-semibold: 600;
--font-bold: 700;
--leading-tight: 1.25;
--leading-normal: 1.5;
--leading-relaxed: 1.75;
Color Palette
--color-primary-50: #eff6ff;
--color-primary-100: #dbeafe;
--color-primary-500: #3b82f6;
--color-primary-600: #2563eb;
--color-primary-700: #1d4ed8;
--color-gray-50: #f9fafb;
--color-gray-100: #f3f4f6;
--color-gray-500: #6b7280;
--color-gray-900: #111827;
--color-success: #10b981;
--color-warning: #f59e0b;
--color-error: #ef4444;
--color-info: #3b82f6;
@media (prefers-color-scheme: dark) {
--bg-primary: #111827;
--bg-secondary: #1f2937;
--text-primary: #f9fafb;
--text-secondary: #9ca3af;
}
Spacing System
--space-0: 0;
--space-1: 0.25rem;
--space-2: 0.5rem;
--space-3: 0.75rem;
--space-4: 1rem;
--space-5: 1.25rem;
--space-6: 1.5rem;
--space-8: 2rem;
--space-10: 2.5rem;
--space-12: 3rem;
--space-16: 4rem;
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);
Breakpoints
--breakpoint-sm: 640px;
--breakpoint-md: 768px;
--breakpoint-lg: 1024px;
--breakpoint-xl: 1280px;
--breakpoint-2xl: 1536px;
Component Patterns
Button
interface ButtonProps {
variant?: 'primary' | 'secondary' | 'ghost' | 'danger';
size?: 'sm' | 'md' | 'lg';
disabled?: boolean;
loading?: boolean;
leftIcon?: React.ReactNode;
rightIcon?: React.ReactNode;
}
const variants = {
primary: 'bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500',
secondary: 'bg-gray-100 text-gray-900 hover:bg-gray-200 focus:ring-gray-500',
ghost: 'text-gray-600 hover:bg-gray-100 focus:ring-gray-500',
danger: 'bg-red-600 text-white hover:bg-red-700 focus:ring-red-500',
};
const sizes = {
sm: 'px-3 py-1.5 text-sm',
md: 'px-4 py-2 text-base',
lg: 'px-6 py-3 text-lg',
};
Input
interface InputProps {
type?: 'text' | 'email' | 'password' | 'number';
error?: string;
hint?: string;
leftAddon?: React.ReactNode;
rightAddon?: React.ReactNode;
}
const states = {
default: 'border-gray-300 focus:border-primary-500 focus:ring-primary-500',
error: 'border-red-500 focus:border-red-500 focus:ring-red-500',
disabled: 'bg-gray-100 cursor-not-allowed',
};
Card
interface CardProps {
variant?: 'elevated' | 'outlined' | 'filled';
padding?: 'none' | 'sm' | 'md' | 'lg';
interactive?: boolean;
}
const Card = ({ variant = 'elevated', padding = 'md', interactive, children }) => {
const baseStyles = 'rounded-xl transition-all';
const variantStyles = {
elevated: 'bg-white shadow-md',
outlined: 'bg-white border border-gray-200',
filled: 'bg-gray-50',
};
const paddingStyles = {
none: '',
sm: 'p-4',
md: 'p-6',
lg: 'p-8',
};
const interactiveStyles = interactive ? 'cursor-pointer hover:shadow-lg' : '';
return (
<div className={`${baseStyles} ${variantStyles[variant]} ${paddingStyles[padding]} ${interactiveStyles}`}>
{children}
</div>
);
};
Accessibility Checklist
Color Contrast
Keyboard Navigation
Screen Reader
Motion
Performance Optimization
CSS Optimization
- Remove unused styles (PurgeCSS/Tailwind JIT)
- Inline critical CSS
- Watch CSS-in-JS runtime overhead
Layout Optimization
- Minimize CLS (Cumulative Layout Shift)
- Specify image dimensions
- Optimize font loading (font-display: swap)
Rendering Optimization
- Prevent unnecessary rerenders
- Virtual scrolling for long lists
- Lazy loading for images and components
Motion Guide
Duration
--duration-fast: 150ms;
--duration-normal: 200ms;
--duration-slow: 300ms;
Easing
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
--ease-out: cubic-bezier(0, 0, 0.2, 1);
--ease-in: cubic-bezier(0.4, 0, 1, 1);
--ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
Principles
- Use meaningful motion only
- Apply easing to animations over 200ms
- Provide immediate feedback for user actions