whale-igniter 1.2.3 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +19 -2
  2. package/dist/analyzer/insights.js +144 -0
  3. package/dist/commands/adopt.js +20 -0
  4. package/dist/commands/changes.js +127 -0
  5. package/dist/commands/ignite.js +142 -76
  6. package/dist/commands/insights.js +146 -9
  7. package/dist/commands/references.js +193 -0
  8. package/dist/commands/sync.js +8 -0
  9. package/dist/generators/wikiGenerator.js +8 -304
  10. package/dist/index.js +33 -2
  11. package/dist/mcp/server.js +29 -0
  12. package/dist/scanner/extractors/css.js +95 -0
  13. package/dist/scanner/extractors/inline.js +131 -0
  14. package/dist/scanner/extractors/styleBlocks.js +37 -0
  15. package/dist/scanner/normalizer.js +59 -0
  16. package/dist/scanner/tailwindScanner.js +39 -0
  17. package/dist/templates/claude.js +93 -0
  18. package/dist/templates/components.js +45 -0
  19. package/dist/templates/conventions.js +45 -0
  20. package/dist/templates/decisions.js +34 -0
  21. package/dist/templates/foundations.js +34 -0
  22. package/dist/templates/project.js +82 -0
  23. package/dist/utils/aiAvailability.js +25 -0
  24. package/dist/utils/wizardMapping.js +54 -0
  25. package/dist/version.js +1 -1
  26. package/package.json +4 -2
  27. package/packs/atlas/instructions.md +3 -0
  28. package/packs/atlas/manifest.json +8 -0
  29. package/packs/atlas/rules.md +4 -0
  30. package/packs/forge/instructions.md +3 -0
  31. package/packs/forge/manifest.json +8 -0
  32. package/packs/forge/rules.md +4 -0
  33. package/packs/lighthouse/instructions.md +3 -0
  34. package/packs/lighthouse/manifest.json +8 -0
  35. package/packs/lighthouse/rules.md +4 -0
  36. package/packs/scribe/instructions.md +3 -0
  37. package/packs/scribe/manifest.json +8 -0
  38. package/packs/scribe/rules.md +4 -0
  39. package/packs/selene/instructions.md +3 -0
  40. package/packs/selene/manifest.json +7 -0
  41. package/packs/selene/rules.md +4 -0
  42. package/ui-references/INDEX.md +51 -0
  43. package/ui-references/data-display.md +160 -0
  44. package/ui-references/feedback.md +190 -0
  45. package/ui-references/forms.md +192 -0
  46. package/ui-references/layout.md +155 -0
  47. package/ui-references/navigation.md +188 -0
  48. package/ui-references/surface.md +188 -0
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "scribe",
3
+ "version": "0.1.0",
4
+ "description": "Generated docs, recipes and READMEs.",
5
+ "status": "stub",
6
+ "requiresAI": false,
7
+ "auditNote": "Planned for enrichWithAi flow in whale sync. Not functional in v1.3 — infrastructure only."
8
+ }
@@ -0,0 +1,4 @@
1
+ # Scribe Rules
2
+
3
+ - Keep workflows local-first.
4
+ - Prefer deterministic checks before AI enhancement.
@@ -0,0 +1,3 @@
1
+ # Selene Instructions
2
+
3
+ AI-assisted UX intelligence and refinement memory.
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "selene",
3
+ "version": "0.1.0",
4
+ "description": "AI-assisted UX intelligence and refinement memory.",
5
+ "status": "starter",
6
+ "requiresAI": false
7
+ }
@@ -0,0 +1,4 @@
1
+ # Selene Rules
2
+
3
+ - Keep workflows local-first.
4
+ - Prefer deterministic checks before AI enhancement.
@@ -0,0 +1,51 @@
1
+ # UI References — Index
2
+
3
+ This library is a curated set of component quality benchmarks drawn from the best production design systems. Consult it when building any UI component: before writing code to understand the quality bar, and when reviewing code to catch common mistakes.
4
+
5
+ AI agents: read this file first to locate the right category, then read that category file for component-specific guidance.
6
+
7
+ ## Categories
8
+
9
+ | File | Covers | When to consult |
10
+ |---|---|---|
11
+ | [forms.md](forms.md) | Button, Input, Select, Checkbox, Radio, Toggle, Textarea | Any user input element |
12
+ | [navigation.md](navigation.md) | Nav bar, Tabs, Sidebar, Breadcrumb, Dropdown menu, Pagination, Command palette | Any wayfinding or navigation element |
13
+ | [feedback.md](feedback.md) | Toast, Modal, Alert, Progress, Loading states, Skeleton, Empty state | Any element that communicates system status |
14
+ | [surface.md](surface.md) | Card, Popover, Tooltip, Sheet, Avatar, Separator, Badge | Any container or overlay surface |
15
+ | [layout.md](layout.md) | Container, Stack, Grid, Responsive patterns, Sidebar layout | Any structural layout element |
16
+ | [data-display.md](data-display.md) | Table, List, Code block, Stats, Timeline | Any element that presents data |
17
+
18
+ ## Minimum design system
19
+
20
+ A project is considered to have a design system when it has all of the following components implemented to the quality bar described in their respective files:
21
+
22
+ - **Button** — with default, hover, focus-visible, active, disabled, loading states and icon variant
23
+ - **Input** — with label, placeholder, error, disabled states and accessible labeling
24
+ - **Select** — keyboard-navigable, with accessible option list
25
+ - **Checkbox** and **Radio** — with indeterminate state for checkbox
26
+ - **Card** — as a reusable surface with consistent padding and radius
27
+ - **Modal / Dialog** — with focus trap, Escape to close, and accessible title
28
+ - **Toast / Notification** — dismissible, accessible, with distinct severity levels
29
+
30
+ These seven families are the minimum. Everything else is project-specific.
31
+
32
+ ## How this library is structured
33
+
34
+ Each category file follows the same format per component:
35
+
36
+ 1. One paragraph on what the component is and why it matters.
37
+ 2. **Reference implementations** — two to four links to high-quality real-world implementations with one sentence on what each gets right.
38
+ 3. **Minimum quality bar** — a checklist of states and behaviors the component must have to ship.
39
+ 4. **Common mistakes** — a short list of patterns to avoid.
40
+
41
+ ## Reference source tiers
42
+
43
+ When citing implementations, this library prioritizes:
44
+
45
+ - **Tier 1** (cited frequently): Linear, Vercel/Geist, Radix UI, shadcn/ui, Sonner, Headless UI, Park UI
46
+ - **Tier 2** (cited when category-appropriate): Material Design 3, Apple HIG, Carbon (IBM), Polaris (Shopify), Fluent (Microsoft), Atlassian, GitHub Primer
47
+ - **Tier 3** (cited for niche or emerging needs): Mantine, Ark UI, Origin UI, Animata
48
+
49
+ ## Contributing
50
+
51
+ To add a component or update a reference link, edit the relevant category file directly. The format per component is fixed — add new components at the end of the file or insert them in frequency order. Do not use AI generation to create entries; references must point to real, stable implementations you have verified.
@@ -0,0 +1,160 @@
1
+ # Data Display — UI References
2
+
3
+ Data display components present information that the user reads but does not directly edit. The quality bar is high: data must be scannable, sortable when appropriate, and never overflow or truncate silently. Accessibility concerns shift from interaction to comprehension: screen readers must be able to navigate tables and lists in a meaningful order.
4
+
5
+ ---
6
+
7
+ ## Table
8
+
9
+ A structured grid of rows and columns. Tables are for relational data where both the row and column identity matter. Do not use tables for layout.
10
+
11
+ ### Reference implementations
12
+
13
+ - **[shadcn/ui Table](https://ui.shadcn.com/docs/components/table)** — semantic HTML (`<table>`, `<thead>`, `<tbody>`, `<th scope="col">`) with Tailwind styling; the correct baseline.
14
+ - **[Radix UI Table](https://www.radix-ui.com/themes/docs/components/table)** — themed table with built-in row hover, column alignment helpers, and condensed/standard density variants.
15
+ - **[TanStack Table](https://tanstack.com/table/latest)** — the leading headless table library; handles sorting, filtering, pagination, and virtual scrolling for large datasets. Consult for any table with more than a few dozen rows.
16
+ - **[Linear's issue list](https://linear.app)** — observe: not a `<table>` but a virtual list; shows how sorting, filtering, and row selection are handled in a list-as-table pattern common in modern apps.
17
+
18
+ ### Minimum quality bar
19
+
20
+ - [ ] Semantic HTML: `<table>`, `<thead>`, `<tbody>`, `<tfoot>` (if total row), `<tr>`, `<th>`, `<td>`
21
+ - [ ] Column headers: `<th scope="col">` with a text description; not just icons
22
+ - [ ] Row headers (if applicable): `<th scope="row">` on the first cell of each row
23
+ - [ ] `<caption>` element or `aria-label` on the table describing what it contains
24
+ - [ ] Sortable columns: `aria-sort="ascending"` / `"descending"` / `"none"` on the column header
25
+ - [ ] Horizontal scroll on small viewports: wrap in `overflow-x: auto` container — do not collapse columns silently
26
+ - [ ] Row selection: checkbox in first column; `aria-checked` on the row (or the checkbox); keyboard: Space to toggle row
27
+ - [ ] Sticky header: `position: sticky; top: 0` — works with `overflow-x: auto` using the right scroll container
28
+ - [ ] Empty state: a single full-width `<td colspan="N">` with an empty state component, not a blank table
29
+
30
+ ### Common mistakes
31
+
32
+ - Using `<div>` grid for tabular data — loses semantic meaning; screen readers cannot navigate by row/column
33
+ - Sortable columns with only visual state and no `aria-sort` — screen reader users can't tell the current sort
34
+ - Truncating cell content silently with `overflow: hidden` — use `text-overflow: ellipsis` and a tooltip for the full value
35
+ - No mobile strategy — either allow horizontal scroll, stack into a card per row, or use a different component for small viewports
36
+
37
+ ---
38
+
39
+ ## List
40
+
41
+ An ordered or unordered sequence of items. Lists are the most common data structure in UI: navigation items, search results, notifications, file trees. Quality lists are scannable and navigable.
42
+
43
+ ### Reference implementations
44
+
45
+ - **[Radix UI List](https://www.radix-ui.com/themes/docs/components/data-list)** — key-value data list pattern; good for detail views and settings pages.
46
+ - **[GitHub Primer ActionList](https://primer.style/components/action-list/react/alpha)** — the most complete reference for a list of interactive items (like a menu, but also used for navigation and selection): dividers, header groups, leading/trailing visuals, single/multi-select.
47
+ - **[TanStack Virtual](https://tanstack.com/virtual/latest)** — for lists with >100 items; virtual scrolling renders only visible items.
48
+
49
+ ### Minimum quality bar
50
+
51
+ - [ ] Semantic HTML: `<ul>` for unordered, `<ol>` for ordered — not `<div>` + `<div>`
52
+ - [ ] Each item is `<li>`; interactive items inside `<li>` use `<a>` or `<button>`, not the `<li>` itself
53
+ - [ ] List roles override when semantics matter: `role="listbox"` + `role="option"` for a selectable list
54
+ - [ ] Keyboard navigation for interactive lists: arrow keys navigate items (roving tabindex or `aria-activedescendant`)
55
+ - [ ] Selected item: `aria-selected="true"` and a visual highlight
56
+ - [ ] Long lists: virtual scrolling or pagination — do not render 1000+ DOM nodes
57
+ - [ ] Grouped lists: each group has a visible heading and `role="group"` with `aria-label` pointing to that heading
58
+
59
+ ### Common mistakes
60
+
61
+ - `<ul>` with `list-style: none` without `role="list"` — some screen readers strip list semantics when list style is removed (add `role="list"` to restore)
62
+ - Interactive items as `<li>` with `onClick` — the `<li>` is not an interactive role; use `<button>` or `<a>` inside
63
+
64
+ ---
65
+
66
+ ## Code Block
67
+
68
+ A formatted display of code, command output, or configuration. Must preserve whitespace, be readable at any content length, and allow copying.
69
+
70
+ ### Reference implementations
71
+
72
+ - **[shadcn/ui](https://ui.shadcn.com)** — observe the code blocks throughout the documentation: copy button in the top-right corner, syntax highlighting, scrollable horizontally, no word wrap.
73
+ - **[Vercel/Geist Code](https://vercel.com/geist/code)** — inline code and block code variants; the inline variant for single-line snippets within prose.
74
+ - **[Shiki](https://shiki.matsu.io/)** — the leading syntax highlighter for static output (no runtime needed); generates semantic token HTML. Use for server-rendered or build-time highlighted code.
75
+
76
+ ### Minimum quality bar
77
+
78
+ - [ ] `<pre><code>` elements — `<pre>` preserves whitespace; `<code>` signals that the content is code
79
+ - [ ] `tabindex="0"` on `<pre>` so keyboard users can scroll the code block
80
+ - [ ] Horizontal scroll on overflow — never wrap code unless the language is prose-like
81
+ - [ ] Copy button in the top-right corner with visual confirmation ("Copied!")
82
+ - [ ] Language label visible (e.g. "TypeScript", "bash") for multi-snippet docs
83
+ - [ ] Dark mode: code blocks often look better with a dark background in both light and dark themes
84
+ - [ ] `aria-label` on the `<pre>` if the language label is not a `<caption>` equivalent
85
+
86
+ ### Common mistakes
87
+
88
+ - `white-space: pre-wrap` on code — wraps long lines in a way that breaks indentation context
89
+ - No horizontal scroll (`overflow-x: hidden`) on code blocks — silently truncates code
90
+ - Copy button that disappears after animation — show "Copied!" for at least 1.5 seconds
91
+
92
+ ---
93
+
94
+ ## Stats / Metrics
95
+
96
+ A display of key numbers or metrics with labels and optional context (trend, change, unit). Common in dashboards, reports, and analytics views.
97
+
98
+ ### Reference implementations
99
+
100
+ - **[shadcn/ui example: Dashboard](https://ui.shadcn.com/examples/dashboard)** — the stat card pattern: large number, label below, trend indicator (up/down arrow + percentage).
101
+ - **[Vercel/Geist](https://vercel.com/geist/components)** — observe the analytics pages: stat value, label, optional sparkline in the card.
102
+ - **[Polaris KPICard](https://polaris.shopify.com)** — handles trend indicators, unit suffixes, comparison to previous period.
103
+
104
+ ### Minimum quality bar
105
+
106
+ - [ ] Number has sufficient contrast and type scale — stat values should be the largest text element in the card
107
+ - [ ] Unit is part of the label or the value (`12.4k`, `$1,234`, `94%`), not ambiguous
108
+ - [ ] Trend indicator (if present): arrow + percentage; green/red with a text label ("Up 12%") — never color-only
109
+ - [ ] Large numbers are formatted with locale-appropriate separators (`toLocaleString()` or `Intl.NumberFormat`)
110
+ - [ ] Loading state is a skeleton with the same dimensions as the loaded state
111
+
112
+ ### Common mistakes
113
+
114
+ - Trend indicator that uses color alone (just a green or red number) — inaccessible; add an up/down arrow or "▲ 12%" text
115
+ - Stats that don't communicate the time period — `$12,400` means nothing without "last 30 days" or similar context
116
+ - Numbers that reflow unpredictably on value change — use `tabular-nums` font feature to prevent layout shift when digits change
117
+
118
+ ---
119
+
120
+ ## Timeline
121
+
122
+ A chronological sequence of events, displayed as a vertical list with connecting lines and time markers. Used in audit logs, activity feeds, version histories.
123
+
124
+ ### Reference implementations
125
+
126
+ - **[GitHub's commit history](https://github.com)** — observe: timestamp, author, branch indicator; condensed view with expand; the connecting line between events.
127
+ - **[Linear activity log](https://linear.app)** — observe in issue detail: avatar + action description + relative time; grouped by day; expandable for details.
128
+ - **[Atlassian Activity Streams](https://atlassian.design)** — enterprise-quality timeline with status changes, user attribution, and grouping.
129
+
130
+ ### Minimum quality bar
131
+
132
+ - [ ] Semantic: use `<ol>` (ordered list) — timeline events are ordered
133
+ - [ ] Each event: timestamp, actor (if applicable), event description
134
+ - [ ] Time shown as relative ("3 minutes ago") with absolute time in a tooltip (`title` attribute or `aria-label`)
135
+ - [ ] Connecting line is decorative (`aria-hidden`); the list semantic conveys the sequence
136
+ - [ ] Long timelines: load more on scroll or paginate — do not render hundreds of events on mount
137
+ - [ ] Events grouped by day: group heading is a visible date, `role="separator"` divider
138
+
139
+ ### Common mistakes
140
+
141
+ - Connecting line as part of the layout that breaks when the viewport narrows
142
+ - Relative timestamps that never update — "5 minutes ago" should update as the user stays on the page
143
+ - No empty state for timelines with no history — "No activity yet" prevents confusion
144
+
145
+ ---
146
+
147
+ ## Badge / Tag (Data Context)
148
+
149
+ A small label attached to data items to communicate category, status, or type. See [surface.md](surface.md) for the component itself; this section covers data-display-specific usage patterns.
150
+
151
+ ### Usage patterns in data display
152
+
153
+ - **Status badges in tables**: align all status badges in the same column; use a fixed-width column so the rest of the row doesn't shift when status changes.
154
+ - **Category tags in lists**: tags that filter the list when clicked become `<button>` elements, not `<span>` — clicking must have a visible effect.
155
+ - **Priority indicators**: if using colored dots or badges for priority (urgent/high/medium/low), always accompany color with a text label or icon — do not rely on color alone.
156
+
157
+ ### Reference implementations
158
+
159
+ - **[Linear's priority + status labels](https://linear.app)** — observe in issue list: priority dot + label, status as a colored chip with text; keyboard accessible in filter panels.
160
+ - **[GitHub labels](https://github.com)** — colored label with text; filter behavior when clicked in issues list; editable in label management UI.
@@ -0,0 +1,190 @@
1
+ # Feedback — UI References
2
+
3
+ Feedback components communicate system status. They answer the user's question "did that work?" They must be timely (not delayed), clear (no ambiguous language), and unobtrusive (not blocking work the user is trying to do). A toast that the user misses, a modal that takes five clicks to dismiss, or an error message with jargon all represent feedback component failures.
4
+
5
+ ---
6
+
7
+ ## Toast / Notification
8
+
9
+ A brief, auto-dismissing message that confirms an action or communicates a system event. Appears without interrupting the user's current task.
10
+
11
+ ### Reference implementations
12
+
13
+ - **[Sonner](https://sonner.emilkowal.ski/)** — the current best-in-class toast library: smooth enter/exit animations, stacking with expansion on hover, rich content with actions, correct `role="status"` for non-urgent messages and `role="alert"` for errors. Study the source for the animation and stacking patterns.
14
+ - **[shadcn/ui Toast (Sonner)](https://ui.shadcn.com/docs/components/sonner)** — Sonner integration with the shadcn/ui theming system.
15
+ - **[Radix UI Toast](https://www.radix-ui.com/primitives/docs/components/toast)** — alternative implementation; observe how it handles `swipeDirection` and the viewport positioning.
16
+ - **[Linear's toasts](https://linear.app)** — observe in the app: appear bottom-left, short duration, action button inline, stack without expanding (up to ~3 visible), oldest auto-dismisses when stack is full.
17
+
18
+ ### Minimum quality bar
19
+
20
+ - [ ] Non-critical toasts: `role="status"`, `aria-live="polite"` — screen reader announces after current speech finishes
21
+ - [ ] Error/warning toasts: `role="alert"`, `aria-live="assertive"` — screen reader announces immediately
22
+ - [ ] Auto-dismiss after 4–6 seconds; longer for messages with actions
23
+ - [ ] Dismiss button always present; hover pauses auto-dismiss timer
24
+ - [ ] Stacking: at most 3–5 toasts visible; oldest dismiss when stack is full
25
+ - [ ] Positioned away from interactive elements (bottom corner, not covering nav)
26
+ - [ ] Keyboard: Tab reaches the toast's action/dismiss button while it is visible
27
+ - [ ] Mobile: full-width at bottom, swipe-to-dismiss gesture
28
+
29
+ ### Common mistakes
30
+
31
+ - Using `alert` role for success messages — causes screen readers to interrupt unnecessarily
32
+ - Auto-dismissing error messages — errors must persist until acknowledged
33
+ - Toasts covering important page content (especially modals or forms mid-submission)
34
+ - No action button for "undo" actions — missed opportunity to recover from mistakes
35
+
36
+ ---
37
+
38
+ ## Modal / Dialog
39
+
40
+ A focused overlay that interrupts the user's workflow to demand attention or a decision. Use sparingly: modals block the background and demand immediate resolution.
41
+
42
+ ### Reference implementations
43
+
44
+ - **[Radix UI Dialog](https://www.radix-ui.com/primitives/docs/components/dialog)** — the reference implementation: focus trap, `role="dialog"`, `aria-modal="true"`, Escape to close, scroll lock on body, correct overlay with `aria-hidden` on background content.
45
+ - **[shadcn/ui Dialog](https://ui.shadcn.com/docs/components/dialog)** — Radix Dialog with Tailwind; includes `DialogHeader`, `DialogTitle` (required), `DialogDescription` (recommended), `DialogFooter` pattern.
46
+ - **[Headless UI Dialog](https://headlessui.com/react/dialog)** — alternative, with the `initialFocus` ref pattern for controlling which element receives focus when the modal opens.
47
+
48
+ ### Minimum quality bar
49
+
50
+ - [ ] `role="dialog"` and `aria-modal="true"` on the dialog container
51
+ - [ ] `aria-labelledby` pointing to the dialog title; `aria-describedby` pointing to the description
52
+ - [ ] Focus trap: Tab and Shift+Tab cycle only within the modal while open
53
+ - [ ] First focusable element receives focus on open (or explicitly set with `autoFocus`)
54
+ - [ ] Escape closes the modal; clicking the overlay closes it; focus returns to the trigger
55
+ - [ ] Body scroll is locked while modal is open; background content is `aria-hidden="true"`
56
+ - [ ] Destructive modal: the destructive action is not the default focused button
57
+ - [ ] Animation: fade + scale in, fade + scale out; respects `prefers-reduced-motion`
58
+
59
+ ### Common mistakes
60
+
61
+ - Modal without a visible title — `DialogTitle` is required even if visually hidden; without it screen readers have no context
62
+ - Focus returning to page top (not the trigger) after modal closes
63
+ - Modals that cannot be dismissed without taking an action — always provide a way out
64
+ - Nested modals — almost always a design problem that should be solved differently
65
+
66
+ ---
67
+
68
+ ## Alert / Banner
69
+
70
+ An inline message that communicates status, warnings, or errors within the page content. Unlike toasts, alerts do not auto-dismiss and are integrated into the layout.
71
+
72
+ ### Reference implementations
73
+
74
+ - **[shadcn/ui Alert](https://ui.shadcn.com/docs/components/alert)** — clean implementation with icon + title + description pattern; default and destructive variants.
75
+ - **[Radix UI Callout](https://www.radix-ui.com/themes/docs/components/callout)** — four severity levels (info, success, warning, error) with icon and text.
76
+ - **[Polaris Banner](https://polaris.shopify.com/components/feedback-indicators/banner)** — good reference for how to handle actionable alerts (with dismiss, with action button, with expansion for details).
77
+ - **[GitHub Primer Flash](https://primer.style/components/flash/react/alpha)** — persistent alerts with full-width option for page-level messages.
78
+
79
+ ### Minimum quality bar
80
+
81
+ - [ ] Four severity levels: info, success, warning, error — visually distinct beyond color (icon, border, label)
82
+ - [ ] `role="alert"` only for genuinely urgent messages that need immediate announcement; `role="status"` for success and info
83
+ - [ ] Dismissible alerts have a close button with `aria-label="Dismiss"`
84
+ - [ ] Actionable alerts: action button is secondary style (not primary — the alert should not compete with the page's primary action)
85
+ - [ ] Error alerts that accompany form validation: positioned near (or above) the form, not at page top
86
+
87
+ ### Common mistakes
88
+
89
+ - `role="alert"` on every informational message — causes constant interruptions for screen reader users
90
+ - Color alone to convey severity — red text, yellow text without icon or label are inaccessible
91
+ - Alerts that appear and disappear too quickly — users miss them or can't read the message
92
+
93
+ ---
94
+
95
+ ## Progress Indicator
96
+
97
+ Communicates how far along a process is. Two types: determinate (known progress) and indeterminate (working but no ETA).
98
+
99
+ ### Reference implementations
100
+
101
+ - **[Radix UI Progress](https://www.radix-ui.com/primitives/docs/components/progress)** — `role="progressbar"`, `aria-valuenow`, `aria-valuemin`, `aria-valuemax` correctly implemented; smooth transition on value change.
102
+ - **[shadcn/ui Progress](https://ui.shadcn.com/docs/components/progress)** — clean linear progress bar; the animated indeterminate variant shows the pattern.
103
+
104
+ ### Minimum quality bar
105
+
106
+ - [ ] Determinate: `role="progressbar"` with `aria-valuenow`, `aria-valuemin="0"`, `aria-valuemax="100"`, `aria-valuetext` for human-readable labels ("Step 2 of 5")
107
+ - [ ] Indeterminate: `aria-valuenow` omitted; CSS animation for visual motion; respects `prefers-reduced-motion` (reduce animation, don't remove it)
108
+ - [ ] Multi-step progress: step labels visible at all steps; completed steps visually distinct from future steps
109
+ - [ ] Color: progress fill must pass 3:1 contrast against the track
110
+
111
+ ### Common mistakes
112
+
113
+ - Indeterminate progress bar staying for too long — show estimated time after 3+ seconds or switch to a spinner with a status message
114
+ - Progress that jumps backwards (data re-loading or error recovery) — disorienting; hold the last value if you can't go backwards meaningfully
115
+
116
+ ---
117
+
118
+ ## Loading State
119
+
120
+ Communicates that the system is working. Must be immediate (appear within 100ms of an action) and honest (not appear when there is nothing to load).
121
+
122
+ ### Reference implementations
123
+
124
+ - **[Vercel/Geist Spinner](https://vercel.com/geist/spinner)** — minimal spinner; used inline and as a page-level overlay; the spinning animation is smooth.
125
+ - **[Radix UI Spinner (Themes)](https://www.radix-ui.com/themes/docs/components/spinner)** — several sizes, accessible.
126
+ - **[Linear loading](https://linear.app)** — observe: spinner appears within 100ms, replaces content (not overlays it in most cases), disappears immediately when content is ready.
127
+
128
+ ### Minimum quality bar
129
+
130
+ - [ ] Appears within 100ms of triggering the async operation
131
+ - [ ] `role="status"` and `aria-label="Loading"` so screen readers announce it
132
+ - [ ] Replaces or overlays only the content being loaded — not the entire page for partial updates
133
+ - [ ] `prefers-reduced-motion`: reduce animation speed or show a static icon instead of spinning
134
+ - [ ] Spinner disappears immediately when load completes — no artificial minimum duration
135
+
136
+ ### Common mistakes
137
+
138
+ - Loading overlay covering the full viewport for a small update in one section
139
+ - Minimum loading time ("show spinner for at least 500ms") — adds latency without benefit
140
+ - No loading state at all for operations that take >300ms — users think nothing happened and click again
141
+
142
+ ---
143
+
144
+ ## Skeleton
145
+
146
+ A placeholder that previews the shape of content while it loads. More useful than a generic spinner for content-heavy layouts.
147
+
148
+ ### Reference implementations
149
+
150
+ - **[shadcn/ui Skeleton](https://ui.shadcn.com/docs/components/skeleton)** — minimal base implementation: pulse animation, neutral background, matches the shape of the content it replaces.
151
+ - **[Polaris SkeletonPage](https://polaris.shopify.com/components/feedback-indicators/skeleton-page)** — full-page skeleton with SkeletonBodyText, SkeletonDisplayText, SkeletonThumbnail; good reference for compositional approach.
152
+
153
+ ### Minimum quality bar
154
+
155
+ - [ ] Matches the approximate layout and shape of the real content
156
+ - [ ] Pulse animation (opacity oscillation) is gentler than shimmer (left-to-right gradient) for users with motion sensitivity
157
+ - [ ] `aria-hidden="true"` on skeleton elements — they are decorative; screen readers should not read them
158
+ - [ ] Use `aria-busy="true"` on the container while loading; `aria-busy="false"` when content is ready
159
+ - [ ] Skeleton does not shift layout when content loads — reserve space accurately
160
+
161
+ ### Common mistakes
162
+
163
+ - Skeleton that looks nothing like the real content — causes layout shift and disorientation when content appears
164
+ - Skeleton persisting after content has loaded — even briefly, confusing to users
165
+
166
+ ---
167
+
168
+ ## Empty State
169
+
170
+ The state of a view when there is no data to display. One of the most neglected components, and one of the most important for user retention.
171
+
172
+ ### Reference implementations
173
+
174
+ - **[Linear's empty states](https://linear.app)** — observe in fresh workspace: illustration or icon, clear heading, specific explanation of why it's empty, one actionable next step. Never just "No items found."
175
+ - **[Polaris EmptyState](https://polaris.shopify.com/components/layout-and-structure/empty-state)** — image + heading + description + primary action + (optional) secondary action; the structure to follow.
176
+ - **[GitHub empty states](https://github.com)** — observe in repositories, issues, projects: different copy for "nothing exists yet" vs "nothing matches your filter" — those are two different problems.
177
+
178
+ ### Minimum quality bar
179
+
180
+ - [ ] Distinct copy for "nothing exists yet" vs "nothing matches current filters" — different user problems
181
+ - [ ] At least one call to action ("Create your first X", "Clear filters")
182
+ - [ ] Visual treatment: icon or illustration (not a blank white box)
183
+ - [ ] When filtered and empty: show what filter is active; offer "Clear all filters"
184
+ - [ ] Error state (couldn't load) is distinct from empty state (loaded but empty) — error needs a retry
185
+
186
+ ### Common mistakes
187
+
188
+ - Generic "No results" with no context or action — leaves users stranded
189
+ - Empty state that looks like a bug — provide enough context that users trust the app is working correctly
190
+ - Same empty state for all situations — loading error, empty dataset, and filter-with-no-results are three different states
@@ -0,0 +1,192 @@
1
+ # Forms — UI References
2
+
3
+ Form elements are the primary way users take action in an application. Poor form components are the leading cause of accessibility failures and the most common source of user frustration. Every form element must work without a mouse, communicate its state clearly, and never lose the user's input silently.
4
+
5
+ ---
6
+
7
+ ## Button
8
+
9
+ The most-pressed element in any UI. A button communicates that something will happen immediately when activated. It is not a link (links navigate). It is not a div with an onClick.
10
+
11
+ ### Reference implementations
12
+
13
+ - **[shadcn/ui Button](https://ui.shadcn.com/docs/components/button)** — clean variant system (default, destructive, outline, ghost, link), loading state pattern with spinner-in-place, correct use of `asChild` for polymorphic rendering without breaking semantics.
14
+ - **[Radix UI Button primitive](https://www.radix-ui.com/themes/docs/components/button)** — shows how to handle the icon variant with `gap` and `size` scaling; the size scale is worth copying verbatim.
15
+ - **[Vercel/Geist Button](https://vercel.com/geist/button)** — minimal, high-contrast, used in production at scale; the loading spinner that replaces label text (not appended to it) is the right pattern.
16
+ - **[Linear buttons](https://linear.app)** — observe in the app: focus-visible rings that match brand accent, 36px height control, icon-only buttons with tooltip, destructive confirmation pattern.
17
+
18
+ ### Minimum quality bar
19
+
20
+ - [ ] Default, hover, focus-visible, active, disabled states are all visually distinct
21
+ - [ ] Loading state: spinner replaces or overlays label; button is `disabled` during load
22
+ - [ ] With-icon variant: icon + label with consistent gap (4–6px); icon-only variant with tooltip
23
+ - [ ] Destructive variant: red/danger color, distinct from default primary
24
+ - [ ] Touch target minimum 44×44px on mobile (use padding, not just height)
25
+ - [ ] `type="button"` is explicit; never rely on browser default type in a form context
26
+ - [ ] Keyboard: Enter and Space both activate; Tab reaches the button
27
+ - [ ] Disabled state uses the `disabled` attribute, not just visual styling
28
+
29
+ ### Common mistakes
30
+
31
+ - Using `<div>` or `<a>` for buttons that trigger actions — breaks keyboard and screen reader access
32
+ - Removing the focus ring with `outline: none` without a replacement — kills keyboard navigation
33
+ - Disabling buttons without explaining why — trap users who don't understand the state
34
+ - Using color alone to distinguish destructive from default — fails color-blind users
35
+
36
+ ---
37
+
38
+ ## Input
39
+
40
+ A single-line text field. The workhorse of data entry. Quality inputs reduce errors by making their state unambiguous at a glance.
41
+
42
+ ### Reference implementations
43
+
44
+ - **[shadcn/ui Input](https://ui.shadcn.com/docs/components/input)** — clean baseline with label separation, consistent height, and error state color; pairs well with the Form component for validation messaging.
45
+ - **[Radix UI Form](https://www.radix-ui.com/primitives/docs/components/form)** — the best reference for the full label + input + error message pattern with accessible ARIA wiring.
46
+ - **[Vercel/Geist Input](https://vercel.com/geist/input)** — prefix/suffix slot pattern (icon or text before/after the field) handled without hacks.
47
+ - **[Polaris TextField](https://polaris.shopify.com/components/selection-and-input/text-field)** — character count, multiline behavior, inline error, and help text all handled consistently.
48
+
49
+ ### Minimum quality bar
50
+
51
+ - [ ] Label is a real `<label>` with `for` pointing to the input's `id` — not a placeholder
52
+ - [ ] Placeholder text is supplementary, not a label replacement; it disappears on type
53
+ - [ ] Error state: red border + error message below the field (not inside it); `aria-describedby` links them
54
+ - [ ] Disabled state: grayed, non-interactive; communicates not the same as read-only
55
+ - [ ] Read-only state: selectable text, different visual treatment from disabled
56
+ - [ ] Focus state: visible ring on `focus-visible`, not on `focus` (avoids focus ring on click)
57
+ - [ ] Prefix/suffix slots for icons or units (e.g. "$", "px") without breaking layout
58
+ - [ ] Mobile: correct `inputmode` and `type` attributes to trigger the right keyboard
59
+
60
+ ### Common mistakes
61
+
62
+ - Using placeholder as label — fails when the field has a value; inaccessible to screen readers
63
+ - `outline: none` on focus without replacement — invisible focus indicator
64
+ - Showing error messages before the user has interacted — don't validate on mount
65
+ - Input width set to 100% everywhere — inputs should have a width appropriate to their expected content
66
+
67
+ ---
68
+
69
+ ## Select
70
+
71
+ A dropdown for choosing one option from a set. Native `<select>` is accessible but unstyled; custom selects require careful ARIA construction to match native behavior.
72
+
73
+ ### Reference implementations
74
+
75
+ - **[Radix UI Select](https://www.radix-ui.com/primitives/docs/components/select)** — the canonical reference for building an accessible custom select: `combobox` role, `listbox` for options, arrow key navigation, type-to-filter. Copy the ARIA pattern, not just the visuals.
76
+ - **[shadcn/ui Select](https://ui.shadcn.com/docs/components/select)** — Radix Select with Tailwind styling; the search-within-select is in Combobox (different component).
77
+ - **[Headless UI Listbox](https://headlessui.com/react/listbox)** — alternative implementation with slightly different API; good for comparing two approaches to the same problem.
78
+
79
+ ### Minimum quality bar
80
+
81
+ - [ ] Keyboard: Up/Down arrows navigate options; Enter/Space selects; Escape closes; Home/End jump to first/last
82
+ - [ ] When closed, shows selected value (not placeholder unless nothing is selected)
83
+ - [ ] Supports option groups (`optgroup` semantics in custom select)
84
+ - [ ] Long option lists: the dropdown scrolls; first visible option after typing matches
85
+ - [ ] Touch: tap opens overlay positioned relative to viewport, not overflowing
86
+ - [ ] `aria-required` and `aria-invalid` passed through when applicable
87
+
88
+ ### Common mistakes
89
+
90
+ - Building a custom select with `<div>` and `onClick` only — breaks keyboard and screen reader
91
+ - Opening the dropdown on hover — wrong interaction model; selects open on click/keypress
92
+ - Closing the dropdown on scroll of the parent page — confuses users mid-selection
93
+
94
+ ---
95
+
96
+ ## Checkbox
97
+
98
+ A toggle for boolean state or for selecting items from a list. Use checkbox (not radio) when multiple selections are valid.
99
+
100
+ ### Reference implementations
101
+
102
+ - **[Radix UI Checkbox](https://www.radix-ui.com/primitives/docs/components/checkbox)** — correct ARIA role, indeterminate state exposed as `data-state="indeterminate"`, animated check mark with CSS transition.
103
+ - **[shadcn/ui Checkbox](https://ui.shadcn.com/docs/components/checkbox)** — minimal, paired with label using the `FormControl` + `FormLabel` pattern worth copying.
104
+ - **[Headless UI Checkbox](https://headlessui.com/react/checkbox)** — headless approach showing all the keyboard event handling necessary.
105
+
106
+ ### Minimum quality bar
107
+
108
+ - [ ] Three states: unchecked, checked, indeterminate (for select-all patterns)
109
+ - [ ] Label is clickable and associated with `<label>` or `aria-label`
110
+ - [ ] Focus ring visible on keyboard focus; not on click
111
+ - [ ] Space bar toggles in all browsers
112
+ - [ ] In a group: each checkbox is independently labeled
113
+ - [ ] Indeterminate state is set via JS (not HTML attribute) and communicated via `aria-checked="mixed"`
114
+
115
+ ### Common mistakes
116
+
117
+ - Using indeterminate as a third state (it is not — it means "some children are checked")
118
+ - Making the hit area the checkbox icon only — label must be part of the hit area
119
+
120
+ ---
121
+
122
+ ## Radio
123
+
124
+ A single-selection control. When the user must choose exactly one option from a visible, bounded list. Use a Select for long lists (7+ options).
125
+
126
+ ### Reference implementations
127
+
128
+ - **[Radix UI Radio Group](https://www.radix-ui.com/primitives/docs/components/radio-group)** — `role="radiogroup"` on the container, `role="radio"` on each item, arrow key navigation between options in the group (not Tab).
129
+ - **[shadcn/ui Radio Group](https://ui.shadcn.com/docs/components/radio-group)** — clean implementation with `RadioGroupItem` + `Label` pairing.
130
+
131
+ ### Minimum quality bar
132
+
133
+ - [ ] Arrow keys navigate within the group; Tab moves past the group to the next focusable element
134
+ - [ ] Only one radio in the group receives Tab focus at a time (roving tabindex)
135
+ - [ ] All radios share the same `name` attribute (native) or group context
136
+ - [ ] Pre-selected option: one option should have a default unless the absence of a choice is meaningful
137
+ - [ ] Label is always to the right of the radio circle (left-to-right layouts)
138
+
139
+ ### Common mistakes
140
+
141
+ - Replacing a radio group with separate checkboxes — removes the mutually-exclusive semantic
142
+ - Making all radios Tab-focusable independently — breaks keyboard navigation model
143
+
144
+ ---
145
+
146
+ ## Toggle / Switch
147
+
148
+ A binary control that takes effect immediately, without a submit action. Distinct from a checkbox: checkboxes submit a form, toggles apply instantly.
149
+
150
+ ### Reference implementations
151
+
152
+ - **[Radix UI Switch](https://www.radix-ui.com/primitives/docs/components/switch)** — `role="switch"`, `aria-checked` updates immediately, smooth sliding animation that communicates the state transition.
153
+ - **[shadcn/ui Switch](https://ui.shadcn.com/docs/components/switch)** — good example of label-on-right with description below.
154
+ - **[Headless UI Switch](https://headlessui.com/react/switch)** — headless; useful for understanding what keyboard events need handling.
155
+
156
+ ### Minimum quality bar
157
+
158
+ - [ ] `role="switch"` with `aria-checked`
159
+ - [ ] Space and Enter both toggle
160
+ - [ ] Visual change is animated (helps users understand the state change happened)
161
+ - [ ] Label clearly names what is being toggled (not just "On/Off")
162
+ - [ ] State change triggers immediately — no submit required
163
+ - [ ] Disabled state with explanation (tooltip or nearby text) when toggle is locked
164
+
165
+ ### Common mistakes
166
+
167
+ - Using a checkbox styled as a toggle — breaks ARIA semantics; `role="switch"` is different
168
+ - Toggle that requires a Save button — breaks the convention; if it needs confirmation, use a modal
169
+
170
+ ---
171
+
172
+ ## Textarea
173
+
174
+ Multi-line text input. Same principles as Input but with a resizing dimension to manage.
175
+
176
+ ### Reference implementations
177
+
178
+ - **[shadcn/ui Textarea](https://ui.shadcn.com/docs/components/textarea)** — `resize-y` allowed, correct row default, auto-grow variant.
179
+ - **[Polaris TextField (multiline)](https://polaris.shopify.com/components/selection-and-input/text-field)** — character count below the field with warning at 80% capacity.
180
+
181
+ ### Minimum quality bar
182
+
183
+ - [ ] User can resize vertically (allow `resize-y`); horizontal resize is usually disruptive
184
+ - [ ] `rows` attribute sets a sensible default height (not 2 — at least 4)
185
+ - [ ] Character count visible when there is a limit
186
+ - [ ] Same error, disabled, read-only, focus states as Input
187
+ - [ ] Auto-growing textarea (optional but high quality): height expands with content up to a max
188
+
189
+ ### Common mistakes
190
+
191
+ - Preventing all resize — users have different viewport and font sizes
192
+ - Setting `height: auto` without `min-height` — collapses to zero on empty value