-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathshadcn-ui.cursorrules
More file actions
24 lines (20 loc) · 1.21 KB
/
shadcn-ui.cursorrules
File metadata and controls
24 lines (20 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# shadcn/ui Rules
## Component Usage
- Import components from @/components/ui/, never from shadcn source
- Use the CLI to add new components: npx shadcn-ui@latest add [component]
- Do not modify files in components/ui/ directly — extend with wrapper components instead
- Always check if a component exists before creating a custom version
## Styling
- Use the cn() utility for conditional classes, never string concatenation
- Follow the existing color convention: use CSS variables (--primary, --secondary, etc.) not raw Tailwind colors
- Dark mode: rely on the built-in dark: variants already in shadcn components
- Do not add custom colors without defining them in globals.css as CSS variables
## Patterns
- Forms: use react-hook-form + zod with shadcn Form components
- Dialogs/Sheets: manage open state with controlled components, not refs
- Tables: use @tanstack/react-table with shadcn DataTable pattern
- Toast notifications: use the sonner integration, not custom toast implementations
## Anti-patterns
- Do not wrap shadcn components in unnecessary divs for styling — use className prop
- Do not mix Headless UI or Radix primitives directly when shadcn already wraps them
- Do not hardcode colors — always use theme tokens