# Libraries Reach for few dependencies, each doing real work. If the project already has a choice for a role, keep it. Install current stable versions (`npm view version`). Don't add a library for something CSS or the platform already does well. ## Pick a base by project type | Project | Stack | |---|---| | Static page, single landing page, prototype | Plain HTML + `tokens.css` + a little vanilla JS. No framework. | | Content site, blog, docs, marketing site | **Astro** (static by default, islands where needed). MDX for content. | | Interactive SPA, internal tool, dashboard (no SEO needs) | **Vite + React + TypeScript**. | | Product with SEO, auth, server data, many routes | **Next.js (App Router) + TypeScript**. | | Team already on Vue / Svelte | **Nuxt** or **SvelteKit**; map the roles below to their equivalents. | ## Roles (React defaults) | Role | Default | Notes | |---|---|---| | Styling | `tokens.css` + **CSS Modules** or **Tailwind v4** | Tailwind only with tokens mapped into `@theme` (`tailwind.md`). Never a second color system alongside the tokens. | | Accessible primitives | **Radix UI** primitives (or **shadcn/ui** for copy-in components) | shadcn's stock look is a known AI tell: always restyle it to the tokens (radius, colors, fonts, shadows). | | Icons | **Lucide** (`lucide-react`) | One icon set per project. 16px in dense UI, 20px default, `stroke-width` 1.75. Never emoji as icons. | | Fonts | `@fontsource/` or `next/font/google` | Self-host to avoid layout shift; set `font-display: swap`. | | Routing | Framework router; **TanStack Router** or **React Router** for Vite SPAs | Type-safe routes when available. | | Server state | **TanStack Query** | Caching, retries, loading/error states. Don't hand-roll fetch-in-`useEffect`. | | Client state | React state/context first; **Zustand** when shared state grows | No Redux unless the project has it. | | Forms + validation | **React Hook Form** + **Zod** | Zod schemas double as API types. | | Tables | **TanStack Table** | Headless; style with tokens. | | Charts | **Recharts** for standard charts; **visx** or **D3** for custom | Color from tokens; load the `dataviz` skill if present. | | Motion | CSS transitions first; **Motion** (`motion/react`) for orchestrated sequences, layout and gestures | Always honor reduced motion. | | Toasts | **Sonner** | Restyle to tokens. | | Command palette | **cmdk** | | | Dates | **date-fns** (or `Intl` alone for formatting) | Format with `Intl.DateTimeFormat`/`NumberFormat` for locale-aware output. | | Markdown | **react-markdown** + **remark-gfm** | | | Syntax highlighting | **Shiki** | Pick a theme pair that matches both color themes. | | Testing | **Vitest** + **Testing Library**; **Playwright** for e2e and screenshots | Playwright also gives the one rendered check before shipping. | | Lint/format | ESLint (flat config) + Prettier, or **Biome** | Match the project. | ## Don't reach for - Full UI kits with a strong look of their own (Material UI, Ant Design, Chakra default theme, Bootstrap) unless the project already uses one. They fight the tokens. - Animation libraries for hover states. - jQuery, Moment.js, Lodash as a whole (import single functions or use the platform). - CSS-in-JS runtimes (styled-components, Emotion) in new projects. They cost runtime and clash with server components. - Icon fonts.