Created
March 7, 2025 06:13
-
-
Save jacobparis/ee4d1659896d24130651bca780a3fbbb to your computer and use it in GitHub Desktop.
shadcn-ui cursor rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
description: "Use shadcn/ui components as needed for any UI code" | |
patterns: "*.tsx" | |
--- | |
# Shadcn UI Components | |
This project uses @shadcn/ui for UI components. These are beautifully designed, accessible components that you can copy and paste into your apps. | |
## Finding and Using Components | |
Components are available in the `src/components/ui` directory, following the aliases configured in `components.json` | |
## Using Components | |
Import components from the ui directory using the configured aliases: | |
```tsx | |
import { Button } from "@/components/ui/button" | |
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" | |
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" | |
``` | |
Example usage: | |
```tsx | |
<Button variant="outline">Click me</Button> | |
<Card> | |
<CardHeader> | |
<CardTitle>Card Title</CardTitle> | |
<CardDescription>Card Description</CardDescription> | |
</CardHeader> | |
<CardContent> | |
<p>Card Content</p> | |
</CardContent> | |
<CardFooter> | |
<p>Card Footer</p> | |
</CardFooter> | |
</Card> | |
``` | |
## Installing Additional Components | |
Many more components are available but not currently installed. You can view the complete list at https://ui.shadcn.com/r | |
To install additional components, use the Shadcn CLI: | |
```bash | |
npx shadcn@latest add [component-name] | |
``` | |
For example, to add the Accordion component: | |
```bash | |
npx shadcn@latest add accordion | |
``` | |
Note: `npx shadcn-ui@latest` is deprecated, use `npx shadcn@latest` instead | |
Some commonly used components are | |
- Accordion | |
- Alert | |
- AlertDialog | |
- AspectRatio | |
- Avatar | |
- Calendar | |
- Checkbox | |
- Collapsible | |
- Command | |
- ContextMenu | |
- DataTable | |
- DatePicker | |
- Dropdown Menu | |
- Form | |
- Hover Card | |
- Menubar | |
- Navigation Menu | |
- Popover | |
- Progress | |
- Radio Group | |
- ScrollArea | |
- Select | |
- Separator | |
- Sheet | |
- Skeleton | |
- Slider | |
- Switch | |
- Table | |
- Textarea | |
- Toast | |
- Toggle | |
- Tooltip | |
## Component Styling | |
This project uses the "new-york" style variant with the "neutral" base color and CSS variables for theming, as configured in `components.json`. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment