Skip to content
SprecherEast
Issue 163

Epic: Shared component library — one tested implementation per UI element

Back to our plan
Open
enhancementfrontendstylinguxpriority: high

Type

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, select and textarea elements outside platform/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

See it on GitHub, opens in a new tab