Skip to content

shadcn Conventions

Use this file before changing UI component scaffolding.

Workspace scope

  • shadcn-generated UI currently lives in apps/widgets.
  • The template at templates/grist-widget-template-vite is separate and may have similar but independent UI setup.

Add a component

From repository root:

bash
pnpm dlx shadcn@latest add button -c apps/widgets

Or inside the workspace:

bash
cd apps/widgets && pnpm dlx shadcn@latest add button

Rules

  • Treat files under apps/widgets/src/components/ui/ as generated primitives.
  • Prefer wrappers in apps/widgets/src/components/ for app-specific customization.
  • Use cn() from apps/widgets/src/lib/utils.ts for class composition.
  • Keep imports on alias paths (example: @/components/ui/button).