Design Guidelines Reference
Complete reference for UI Lab design guidelines. These guidelines help both human developers and AI systems make consistent, beautiful component choices.
Core Principles
1. Beautiful by Default
Every component is beautiful without customization. This means:
- No Tweaking Required – Components work beautifully out of the box
- Consistent Visuals – All components follow the same design language
- Dark/Light Support – Both modes are equally refined
- Responsive – Scales from mobile to desktop gracefully
Implication for AI: Use components as-is. Don't add unnecessary styling or customization.
2. Semantic Over Visual
Component variants have semantic meaning, not just visual differences:
Implication for AI: Choose variants based on semantic meaning, not appearance.
3. Composition Over Configuration
Complex UIs are built by composing simple components, not configuring complex ones:
Implication for AI: Combine simple components rather than using complex mega-components.
4. Accessibility as Foundation
Accessibility is not optional—it's built into every component:
- Keyboard Support – All interactive elements work with keyboard
- Screen Readers – All components are properly labeled
- Focus Management – Clear focus indicators everywhere
- WCAG AA – All components meet WCAG AA standards
Implication for AI: Generated code includes accessibility by default, no need to add it.
Component Selection Guide
When to Use: Button vs. Link
| Need | Component | Reason | |------|-----------|--------| | User performs an action | Button | Changes state, triggers logic | | Navigate to a page | Link | Navigates within app/web | | Navigate + open in new tab | Link | Supports Ctrl+Click | | Submit form | Button | Semantically correct for forms |
Examples:
When to Use: Input vs. TextArea
| Need | Component | Reason | |------|-----------|--------| | Single line of text | Input | Designed for single lines | | Multiple lines of text | TextArea | Designed for multi-line content | | Email/phone/number | Input | Type attribute handles validation | | Long-form text | TextArea | Expandable, comfortable for typing |
Examples:
When to Use: Tabs vs. Menu
| Need | Component | Reason | |------|-----------|--------| | Switch between views | Tabs | Horizontal, all options visible | | Dropdown options | Menu | Vertical, collapsed by default | | Many options | Menu | Better for long lists | | Few primary sections | Tabs | Better for 2-5 sections |
Examples:
When to Use: Modal vs. Popover
| Need | Component | Reason | |------|-----------|--------| | Require immediate response | Modal | Blocks background interaction | | Confirm critical action | Modal | Forces user decision | | Quick info/context | Popover | Non-blocking, can dismiss | | Positioning matters | Popover | Anchors to trigger element |
Examples:
When to Use: Toast vs. Tooltip
| Need | Component | Reason | |------|-----------|--------| | Notification (non-critical) | Toast | Visible, dismissible | | Brief hover help | Tooltip | Appears on hover, disappears | | Background operation feedback | Toast | Persists while user works | | Dense UI explanation | Tooltip | Hidden until hover |
Examples:
Variant Selection Guide
Button Variants
Primary (Default)
- Use when: User should strongly consider this action
- Examples: "Save", "Submit", "Continue", "Complete"
- Appearance: Most prominent, full color
Secondary
- Use when: Alternative action of similar importance
- Examples: "Cancel", "Go Back", "Try Again"
- Appearance: Less prominent than primary
Outline
- Use when: Multiple secondary actions needed
- Examples: "Edit", "Download", "Share"
- Appearance: Outlined, less emphasis
Ghost
- Use when: Tertiary or subtle action
- Examples: "Help", "More Options", "Close"
- Appearance: Minimal, text-only appearance
Form Field States
Default
- Normal, ready for input
- Placeholder visible
- No error shown
Focused
- User is interacting
- Focus ring visible
- Placeholder may disappear
Filled
- User has entered data
- Placeholder gone
- Value visible
Disabled
- User cannot interact
- Typically appears grayed out
- Screen reader announces disabled
Error
- Validation failed
- Error message displayed
- Visual indicator (usually red)
Composition Patterns
Form Pattern
Standard form structure:
Key Points:
- Every input has a Label
- Each FormField contains one input + related elements
- Errors displayed below the field
- Primary button for main action
Card Pattern
Group related content:
Key Points:
- Header for title/summary
- Body for main content
- Footer for actions
- Provides visual grouping
Button Group Pattern
Group related actions:
Key Points:
- Related buttons grouped together
- Appropriate spacing
- Visual distinction between variants
- Consistent sizing
Modal Pattern
Confirm important actions:
Key Points:
- Clear title explaining the decision
- Simple, direct message
- Cancel button on left (secondary)
- Destructive action on right (primary)
- Modal blocks background interaction
List Pattern
Display multiple items:
Key Points:
- Consistent card structure for each item
- Consistent spacing between items
- Action buttons on the right
- Appropriate hover/focus states
Responsive Design Guidelines
Mobile-First Approach
Design for mobile first, then enhance for larger screens:
Breakpoints
| Name | Width | Use |
|------|-------|-----|
| base | 0px | Mobile |
| sm | 640px | Small tablet |
| md | 768px | Tablet |
| lg | 1024px | Desktop |
| xl | 1280px | Large desktop |
Typography Scaling
Text automatically scales based on viewport:
Spacing Scaling
Spacing automatically adjusts to viewport:
Color & Theming Guidelines
Color Tokens
Always use semantic color tokens, never hardcode colors:
Token Categories
Background & Foreground
Semantic Colors
Dark Mode
Components automatically support dark mode. Don't add special dark mode logic:
Accessibility Guidelines
For AI Code Generation
Every generated component must include:
-
Semantic HTML
-
ARIA Labels
-
Form Labels
-
Error Associations
-
Keyboard Support
-
Focus Management
Performance Guidelines
Use Flex and Grid Over DIVs
Lazy Load Heavy Components
Use Container Queries
Common Mistakes to Avoid
❌ Overusing Customization
❌ Nesting Components Wrong
❌ Missing ARIA Labels
❌ Hardcoding Values
❌ Ignoring Dark Mode
Next Steps
- See Component Examples → Examples & Patterns
- View Registry Details → Component Registry Reference
- Learn MCP Integration → MCP Server Setup
These guidelines ensure beautiful, consistent, accessible UIs whether generated by humans or AI.