workout-app / rules
PierreTsia/workout-app/.cursor/rules/prefer-shadcn-components.mdc
Prefer shadcn/ui components over raw HTML elements in React components
Cursor rule0 starsChanged 37 days ago
What's in it
- Prefer shadcn/ui Components
- Available primitives
- How to apply
---
description: Prefer shadcn/ui components over raw HTML elements in React components
globs: src/components/**/*.tsx
alwaysApply: false
---
# Prefer shadcn/ui Components
Always use existing shadcn/ui primitives from `src/components/ui/` before writing raw HTML elements with custom Tailwind classes.
## Available primitives
Badge, Button, Card, Input, Label, Checkbox, Switch, Tabs, Dialog, Sheet, Drawer, Popover, Tooltip, DropdownMenu, AlertDialog, Collapsible, Toggle, ToggleGroup, Separator, ScrollArea, Avatar, Table, Alert, Form, Textarea, Calendar, Command, Carousel, Sonner.
## How to apply
1. Check `src/components/ui/` for an existing component that matches the intent.
2. Use the component's built-in `variant` prop when a standard variant fits.
3. If you need custom colors/sizing beyond the variants, pass them via `className` — the shadcn components all accept it and merge via `cn()`.
4. Only fall back to raw elements (`<button>`, `<div>`, `<span>`) when no shadcn primitive covers the use case.
```tsx
// ❌ BAD — raw button with hand-rolled pill styles
<button className="inline-flex items-center rounded-full border px-2.5 py-1 text-xs font-medium bg-emerald-500/15 text-emerald-300">
{label}
</button>
// ✅ GOOD — Badge with variant + className override
<Badge variant="outline" className="bg-emerald-500/15 text-emerald-300 border-emerald-500/25">
{label}
</Badge>
```
More agent context in PierreTsia/workout-app
23 other files this repository gives its agents.
Copilot instructions
Cursor rule
Skill
- blog-post.cursor/skills/blog-post/SKILL.md
- create-pr.cursor/skills/create-pr/SKILL.md
- deepen-architecture.cursor/skills/deepen-architecture/SKILL.md
- deliver-tickets.cursor/skills/deliver-tickets/SKILL.md
- epic-brief.cursor/skills/epic-brief/SKILL.md
- grill-me.cursor/skills/grill-me/SKILL.md
- grill-with-docs.cursor/skills/grill-with-docs/SKILL.md
- microcopy.cursor/skills/microcopy/SKILL.md
- new-achievement-track.cursor/skills/new-achievement-track/SKILL.md
- pr-review.cursor/skills/pr-review/SKILL.md
- split-tickets.cursor/skills/split-tickets/SKILL.md
- start-branch.cursor/skills/start-branch/SKILL.md
- tdd.cursor/skills/tdd/SKILL.md
- tech-plan.cursor/skills/tech-plan/SKILL.md
- code-review.github/skills/code-review/SKILL.md
- gymlogic-mcpskills/gymlogic-mcp/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
Reports can't be read right now.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

