Frontend Components#
This page documents the frontend component system used in the frontend app.
Source of truth#
frontend/package.jsonfrontend/components.jsonfrontend/src/components
Component stack#
The frontend uses a React + TypeScript component architecture with:
reactandreact-domfor UI renderingclass-variance-authority,clsx, andtailwind-mergefor variant-driven styling@base-ui/reactfor accessible primitivesstorybookfor component development and documentationshadcnconfiguration viafrontend/components.json
shadcn/ui configuration#
The file frontend/components.json defines shared component conventions:
style:base-maiatsx:trueiconLibrary:hugeiconstailwind.css:src/globals.cssAliases: -
@/componentsfor components -@/components/uifor foundational UI pieces -@/liband@/lib/utilsfor shared logic -@/lib/hooksfor reusable hooks
Component directory structure#
The main component directories currently include:
frontend/src/components/
├── ui/ # Reusable design-system style components
├── Dashboard/ # Dashboard feature components (cards, detail views)
├── Admin/ # Admin feature actions and tables
├── Items/ # Item CRUD and table helpers
├── Sidebar/ # App navigation shell pieces
├── UserSettings/ # User account/settings flows
├── Common/ # Shared application-level components
├── form/ # Form components and form hooks
├── status/ # Loading/error/not-found state components
└── stories/ # Storybook stories and docs assets
Recommended usage#
Build from
components/uiwhen possible to keep interaction and styling consistent.Place feature-specific composition in feature folders (for example
Dashboard/orAdmin/).Keep cross-feature shared components in
Common/only when they are not tightly coupled to one domain.Store component stories near
components/storiesso Storybook stays current with implementation.
Adding a new component#
Choose location: - Base/reusable UI:
frontend/src/components/ui- Feature-specific: relevant feature folder underfrontend/src/componentsImplement the component in TypeScript (
.tsx).Add or update Storybook stories in
frontend/src/components/stories.Validate locally: -
npm run dev-npm run storybook-npm run lint