Skip to main content

CODITECT Pattern Library: Quick Reference Card

Print this page for fast pattern lookup

ATOMS (Building Blocks)

PatternUsageCode SnippetTest ID
ButtonActions, submit<button class="btn btn-primary">Create</button>btn-primary
InputText entry<input type="text" class="input" />input-text
Status DotVisual indicator<div class="status-dot status-success"></div>dot-success
AvatarUser identity<img src="..." class="avatar" alt="Name" />avatar-image
BadgeCount/label<span class="badge badge-count">3</span>badge-count
Progress BarCompletion %<div class="progress-bar"><div class="progress-fill" style="width: 65%"></div></div>progress-basic
SkeletonLoading state<div class="skeleton skeleton-text"></div>skeleton-text

MOLECULES (Simple Combos)

PatternAtoms UsedWhen to UseExample
Status IndicatorDot + TextShow entity state<div class="status-indicator"><div class="status-dot status-success"></div><span>Active</span></div>
Avatar StackMultiple AvatarsTeam members<div class="avatar-stack"><img class="avatar avatar-stacked" />...</div>
Search InputInput + Icon + ButtonSite/page search<div class="search-input">...</div>
Form FieldLabel + Input + ErrorUser input<div class="form-field"><label>...</label><input />...</div>
Progress IndicatorBar + LabelTask completion<div class="progress-indicator">...</div>
Button GroupMultiple ButtonsRelated actions<div class="button-group"><button>...</button>...</div>

ORGANISMS (Complex Sections)

PatternMolecules UsedPurposeKey Features
CardStatus, Progress, Avatar StackEntity containerClickable, hover state, sections
ModalForm Fields, Button GroupFocused interactionBackdrop, focus trap, ESC closes
Data TableStatus Indicator, Button GroupTabular dataSortable, selectable, responsive
Navigation BarSearch Input, AvatarPrimary navSticky, active state, responsive
Empty StateButtonNo content placeholderEncouraging, actionable
ToastBadge, ButtonFeedback messageAuto-dismiss, stacking

TEMPLATES (Page Layouts)

TemplateOrganismsUse CaseStructure
Dashboard GridNavbar + Card GridOverviewnavbar → page-header → card-grid
Detail ViewNavbar + Content + SidebarSingle entitynavbar → breadcrumb → main + sidebar
FormNavbar + Form SectionsData entrynavbar → form-header → sections → actions
KanbanNavbar + Column GridWorkflownavbar → page-header → column-grid

QUICK DECISION TREE

"Which pattern should I use?"

Need to trigger action?
├─ Yes → BUTTON atom
└─ No → Continue

Need to display status?
├─ Visual only → STATUS DOT atom
├─ With label → STATUS INDICATOR molecule
└─ No → Continue

Need to show progress?
├─ With label → PROGRESS INDICATOR molecule
├─ Without label → PROGRESS BAR atom
└─ No → Continue

Need to display entity?
├─ Multiple entities → CARD GRID in Dashboard template
├─ Single entity → DETAIL VIEW template
└─ No → Continue

Need user input?
├─ Single field → INPUT atom
├─ Multiple fields → FORM FIELD molecule
├─ Complete form → FORM template
└─ No → Continue

Need to show team?
├─ Individual → AVATAR atom
├─ Multiple → AVATAR STACK molecule
└─ No → Continue

Need feedback?
├─ Temporary → TOAST organism
├─ Modal → MODAL organism
├─ Inline → Form error in FORM FIELD
└─ No → Continue

Loading state?
├─ Fast (<1s) → Spinner (CSS)
├─ Slow (>1s) → SKELETON atom
└─ No → Continue

COLOR REFERENCE

/* Copy-paste into :root */
--white: #FFFFFF;
--gray-50: #F9FAFB; /* Page background */
--gray-100: #F3F4F6; /* Subtle backgrounds */
--gray-200: #E5E7EB; /* Borders */
--gray-400: #9CA3AF; /* Secondary text */
--gray-600: #6B7280; /* Tertiary text */
--gray-700: #374151; /* Labels */
--gray-900: #111827; /* Primary text */

--blue-500: #3B82F6; /* Primary actions */
--blue-600: #2563EB; /* Hover states */

--green-500: #10B981; /* Success */
--yellow-500: #F59E0B; /* Warning */
--red-500: #EF4444; /* Error */

Semantic Usage:

  • Success/Active/Healthy → Green
  • Warning/In Progress → Yellow
  • Error/Blocked/Critical → Red
  • Inactive/Disabled → Gray

SPACING SCALE

/* 8px grid system */
--space-xs: 4px; /* Tight: icon + label */
--space-sm: 8px; /* Related items */
--space-md: 16px; /* Component padding */
--space-lg: 24px; /* Section spacing */
--space-xl: 32px; /* Major sections */
--space-2xl: 48px; /* Page margins */

When to use:

  • XS (4px): Icon to adjacent text
  • SM (8px): List items, flex gap
  • MD (16px): Card padding, form field spacing
  • LG (24px): Between sections
  • XL (32px): Page sections
  • 2XL (48px): Page margins

TYPOGRAPHY SCALE

--text-display: 32px / 600;  /* Page titles (rare) */
--text-headline: 24px / 600; /* Section headers */
--text-title: 18px / 600; /* Card titles */
--text-body: 16px / 400; /* Primary content */
--text-secondary: 14px / 400; /* Metadata */
--text-caption: 12px / 400; /* Labels, hints */

Hierarchy:

  • H1: 24px (page title in content)
  • H2: 18px (section headers)
  • H3: 16px (subsections)
  • Body: 16px (paragraphs)
  • Meta: 14px (timestamps, counts)
  • Caption: 12px (labels, hints)

RESPONSIVE BREAKPOINTS

/* Mobile first */
@media (min-width: 768px) { /* Tablet */ }
@media (min-width: 1024px) { /* Desktop */ }
@media (min-width: 1280px) { /* Wide */ }

Grid Columns:

  • Mobile (< 768px): 1 column
  • Tablet (768-1024px): 2 columns
  • Desktop (1024-1280px): 3 columns
  • Wide (> 1280px): 4 columns

ACCESSIBILITY CHECKLIST

Before shipping any pattern:

  • Keyboard: Tab, Enter, Escape work
  • Focus: Visible indicator (blue outline)
  • ARIA: Proper role, label, state
  • Contrast: 4.5:1 text, 3:1 UI
  • Touch: 44x44px minimum target
  • Alt: Images have descriptions
  • Labels: Inputs have labels
  • Hierarchy: H1 → H2 → H3 (no skips)

COMMON COMBINATIONS

User Profile Header

<div class="profile-header">
<div class="avatar avatar-lg">👤</div>
<div>
<h2>User Name</h2>
<div class="status-indicator">
<div class="status-dot status-success"></div>
<span>Online</span>
</div>
</div>
</div>

Search + Filters

<div class="search-controls">
<div class="search-input">...</div>
<select class="input">...</select>
<button class="btn btn-secondary">Filter</button>
</div>

Page Header with Actions

<div class="page-header">
<div>
<h1 class="page-title">Page Title</h1>
<p class="page-subtitle">Description</p>
</div>
<div class="button-group">
<button class="btn btn-secondary">Secondary</button>
<button class="btn btn-primary">Primary</button>
</div>
</div>

Card with All Features

<article class="card">
<div class="card-header">
<div class="card-icon">🏢</div>
<div class="card-title-group">
<h3 class="card-title">Title</h3>
<div class="status-indicator">
<div class="status-dot status-success"></div>
<span>Active</span>
</div>
</div>
</div>
<div class="card-content">
<p class="card-meta">Metadata</p>
<div class="avatar-stack">
<img class="avatar avatar-stacked" src="..." />
</div>
</div>
<div class="card-footer">
<div class="progress-indicator">
<div class="progress-bar">
<div class="progress-fill" style="width: 75%;"></div>
</div>
<span class="progress-label">75%</span>
</div>
</div>
</article>

TEST COMMANDS

# Run all tests
npm test

# Unit tests only
npm run test:unit

# Accessibility tests
npm run test:a11y

# Visual regression
npm run test:visual

# Update snapshots
npm run test:update-snapshots

# Watch mode
npm run test:watch

# Coverage report
npm run test:coverage

PATTERN USAGE STATS

PatternFrequencyPriority
ButtonVery HighP0
InputVery HighP0
CardHighP1
Status IndicatorHighP1
Progress BarMediumP2
ModalMediumP2
ToastMediumP2
Data TableMediumP2
Empty StateLowP3
Avatar StackLowP3

ANTI-PATTERNS (What NOT to Do)

Multiple Headers

<!-- BAD -->
<header>
<nav></nav>
<div class="breadcrumb"></div>
<div class="page-title"></div>
</header>

Single Header

<!-- GOOD -->
<header>Logo + Nav + Actions</header>
<main>
<h1>Page Title</h1>
</main>

Status as Text Only

<!-- BAD -->
<span>Status: Active and Running</span>

Visual Indicator

<!-- GOOD -->
<div class="status-indicator">
<div class="status-dot status-success"></div>
<span>Active</span>
</div>

Percentage as Text

<!-- BAD -->
<p>Progress: 65 percent complete</p>

Progress Bar

<!-- GOOD -->
<div class="progress-indicator">
<div class="progress-bar">
<div class="progress-fill" style="width: 65%;"></div>
</div>
<span>65%</span>
</div>

Table for Layout

<!-- BAD -->
<table>
<tr>
<td>Card 1</td>
<td>Card 2</td>
</tr>
</table>

Grid Layout

<!-- GOOD -->
<div class="card-grid">
<div class="card">...</div>
<div class="card">...</div>
</div>

DEBUGGING CHECKLIST

Pattern not working? Check:

  1. Data-testid present? Every pattern needs data-testid="pattern-name"
  2. CSS classes correct? Check for typos
  3. Nesting correct? Atoms → Molecules → Organisms
  4. Variables defined? CSS custom properties in :root
  5. Responsive? Test in mobile/tablet/desktop
  6. Accessible? Run axe DevTools
  7. Visual match? Compare to reference screenshots

GETTING HELP

Documentation:

  • Pattern Library Part 1: Atoms & Molecules
  • Pattern Library Part 2: Organisms & Templates
  • Testing Specification: Test criteria for each pattern
  • Implementation Guide: How to integrate

Resources:

  • Component Storybook: /storybook
  • Visual Examples: /examples
  • Test Results: /test-results

Support:

  • Slack: #coditect-design
  • Email: design@coditect.ai
  • Office Hours: Tue 2pm, Thu 10am EST

VERSION HISTORY

v1.0 (Current)

  • Initial pattern library
  • Atoms: 7 patterns
  • Molecules: 6 patterns
  • Organisms: 6 patterns
  • Templates: 4 layouts
  • 100% test coverage
  • WCAG 2.1 AA compliant

QUICK START (30 SECONDS)

  1. Copy design tokens (colors, spacing, typography) to :root
  2. Copy pattern code from reference
  3. Add data-testid attribute
  4. Test accessibility with browser DevTools
  5. Ship it

Print this page | Keep at desk | Reference daily