Epic: Shared component library — one tested implementation per UI element
Back to our planType
enhancement
Summary
Epic. A small set of shared components (about 20) that every screen is built from. Each has one implementation, is tested, and is configured through typed props and variants. Screens use these components, never raw HTML form elements. They live where docs/architecture/ says (platform/ui/, variants with cva, tokens from the theme, #146).
Inventory (sub-issues are added when a screen needs a component)
- Actions: Button (variants for look; renders as a link for navigation,
type="submit"in forms), Link - Forms: Field (label, hint, error, required), TextField (text, email, tel, url, password, number), TextArea (resizable), Select, Checkbox, RadioGroup, Switch, Form
- Content: Card, Badge, Alert, Media, Table (a simple table; a data grid only when a screen needs one)
- Navigation: Tabs, Accordion, Breadcrumbs, Pagination
- Overlays and feedback: Dialog, Toast
Today's primitives in src/components/ui/: alert, button, card, checkbox, input, label, select, textarea.
Rules
- Wrap proven libraries behind our own API (adapter): Radix for accessible behavior, Zod as the single validation engine (one schema checked in the browser and on the server, used with react-hook-form), and TanStack Table only if a grid is needed. Don't build these from scratch.
- Build structure by composition, with small parts such as Tabs, its tab list and its panels. Avoid one component with dozens of flags. Use props and variants for the look.
- Add a component when a second screen needs it. Every file stays under 250 lines.
- A lint rule blocks raw
input,button,selectandtextareaelements outsideplatform/ui/.
Testing
- Each component gets interaction and accessibility tests (Testing Library and axe) and a screenshot of each variant in light and dark.
- End-to-end tests cover user journeys.
- A development-only gallery page shows every component and variant.
Reference sites
The owner shares sites he likes. An agent pulls out their tokens (color, type, spacing, radius) and component patterns, maps them onto this inventory, and builds only what's missing. It takes patterns only, never another site's branding, text or images.
Acceptance criteria
- Not done: The screens in the "Ready for neighbors" milestone use only components from this set.
- Not done: Every component in the set has tests and a gallery entry.
- Not done: The lint rule is on.
Area
frontend, styling, ux
Priority
priority: high
Generated by Claude Code, opens in a new tab
Issues in this epic
#170 · Closed Oct 21
- tech-debt: Pluggable themes: design tokens as a contract, components use tokens only (issue 146)Done
#146 · Closed Oct 26
#121 · Closed Nov 1
#210 · Closed Oct 21
#215 · Closed Oct 26
#217 · Closed Oct 22
#226 · Closed Oct 26
#416 · Closed Oct 26
#418 · Closed Oct 26
#426 · Closed Oct 26
#428 · Closed Oct 26
#430 · Closed Oct 26
#432 · Closed Oct 26
#434 · Closed Oct 26
#437 · Closed Oct 26
#439 · Closed Oct 26
#441 · Closed Oct 26
#448 · Closed Oct 26
#457 · Closed Oct 26
#460 · Closed Oct 26
#461 · Closed Oct 26
#465 · Closed Oct 26
#466 · Closed Oct 27
#468
#208 · Closed Oct 21
#759 · Closed Nov 6
#769
#495 · Closed Nov 6
- documentation: Guidelines still name the deleted shadcn button and a Container component (issue 214)Done
#214 · Closed Oct 24
#328 · Closed Oct 24