# ShadCN UI Quick Reference Guide ## Color Palette ### Text Colors (Tailwind Classes) ``` text-text-primary → #e0e0e0 (main text) text-text-secondary → #a3a3a3 (secondary text) text-text-tertiary → #737373 (muted text) ``` ### Background Colors ``` bg-bg-primary → #171717 bg-bg-secondary → #171717 bg-bg-overlay-light → rgba(255, 255, 255, 0.05) bg-bg-overlay-dark → rgba(0, 0, 0, 0.8) ``` ### Accent & Semantic Colors ``` text-accent-warm → #e8704b (primary accent) text-success → #10b981 text-warning → #f97316 text-danger → #ef4444 text-info → #3b82f6 ``` ## Component Reference ### Button Component ```jsx import { Button } from '../lib/ui'; // Default variants // Sizes // With icons // As child (wrap Link, etc.) // Disabled ``` ### Card Component ```jsx import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '../lib/ui'; Card Title Card description Main content Footer actions ``` ### Badge Component ```jsx import { Badge } from '../lib/ui'; Default Secondary Error Outline Success Warning Info ``` ### Alert Component ```jsx import { Alert, AlertTitle, AlertDescription } from '../lib/ui'; Title Description // With variants Success message Error message Warning message Info message ``` ### Dialog/Modal Component ```jsx import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '../lib/ui'; const [open, setOpen] = useState(false); Dialog Title Optional description

Content goes here

``` ### Input Component ```jsx import { Input } from '../lib/ui'; setValue(e.target.value)} /> ``` ### Label Component ```jsx import { Label } from '../lib/ui'; ``` ### Dropdown Menu Component ```jsx import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from '../lib/ui'; import { Button } from '../lib/ui'; Option 1 Option 2 Option 3 ``` ## Tailwind Utility Classes ### Layout ```jsx // Flexbox
// Grid
// Spacing className="p-4 px-6 py-2" // padding className="m-2 mx-auto" // margin className="gap-4" // grid/flex gap // Size className="w-full h-screen" className="max-w-2xl mx-auto" ``` ### Typography ```jsx // Font sizes className="text-xs text-sm text-base text-lg text-xl text-2xl text-3xl" // Font weights className="font-light font-normal font-semibold font-bold" // Text alignment className="text-left text-center text-right" // Line height className="leading-tight leading-normal leading-relaxed" ``` ### Colors ```jsx // Predefined colors className="text-text-primary" className="bg-bg-secondary" className="text-accent-warm" className="border-text-tertiary" // With opacity className="bg-accent-warm/50" // 50% opacity className="text-danger/80" // 80% opacity ``` ### Borders & Radius ```jsx className="border border-text-tertiary" className="border-b border-t border-l border-r" className="rounded-md rounded-lg rounded-full" className="rounded-t rounded-b rounded-l rounded-r" ``` ### Visibility ```jsx className="block hidden" className="flex md:hidden" // responsive className="invisible opacity-0" className="sr-only" // screen reader only ``` ### Animations ```jsx className="animate-spin" // spinning className="animate-pulse" // pulsing className="transition-all duration-300" className="hover:opacity-80" // hover effect ``` ## Form Patterns ### Basic Form Group ```jsx
{error &&

{error}

} {success &&

Saved!

}
``` ### Form with Card ```jsx Login
``` ## Layout Patterns ### Page Layout ```jsx
{/* page content */}
``` ### Card Grid ```jsx
{items.map(item => ( {/* card content */} ))}
``` ### Two Column Layout ```jsx
{/* main content */}
{/* sidebar */}
``` ## Common Patterns ### Alert with Close ```jsx const [showAlert, setShowAlert] = useState(true); {showAlert && ( Success Operation completed )} ``` ### Button Group ```jsx
``` ### Status Badge ```jsx
Active Online
``` ### Loading State ```jsx import LoadingSpinner from '../components/LoadingSpinner'; {isLoading && } {isLoading && } ``` ### Empty State ```jsx

No items found

Create one to get started

``` ## Responsive Patterns ### Mobile First ```jsx // Base style for mobile, override on larger screens className="flex flex-col md:flex-row" className="text-sm md:text-base lg:text-lg" className="w-full md:w-1/2 lg:w-1/3" className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3" ``` ### Show/Hide on Breakpoint ```jsx className="hidden md:block" // show on medium and up className="md:hidden" // hide on medium and up className="block lg:hidden" // show except on large ``` ## Performance Tips 1. **Use Tailwind for styling**, not inline styles 2. **Keep components small** and focused 3. **Use `className` merging** with `cn()` function for dynamic classes 4. **Avoid unused Tailwind classes** - Tailwind purges them in production 5. **Use semantic HTML** with proper heading hierarchy 6. **Lazy load components** when possible ## Common Issues & Solutions ### Issue: Styles not applying **Solution**: Ensure: - Tailwind is configured correctly in `tailwind.config.js` - CSS is imported in `index.css` with `@tailwind` directives - PostCSS is configured in `postcss.config.js` ### Issue: Colors not matching **Solution**: - Check CSS variables in `:root` of `index.css` - Verify Tailwind config has extended colors - Use exact class names: `text-text-primary` not `text-primary` ### Issue: Component not styled **Solution**: - Verify component is imported from `/lib/ui` - Check `cn()` utility merges classes correctly - Ensure parent has proper `className` applied ## Migration Checklist for New Pages When creating or refactoring a page: - [ ] Use ShadCN Button for all actions - [ ] Use ShadCN Card for content grouping - [ ] Use ShadCN Alert for notifications - [ ] Use ShadCN Dialog for modals - [ ] Use ShadCN Input for form fields - [ ] Use ShadCN Badge for status indicators - [ ] Use Tailwind grid for layouts - [ ] Use Tailwind for spacing and sizing - [ ] Use custom CSS variables for colors - [ ] Follow mobile-first responsive design - [ ] Test on mobile, tablet, and desktop --- **Last Updated**: November 6, 2025