UI Component Architect
This skill guides the creation of premium, consistent UI components for QoreDB.
Core Principles
- Premium Aesthetics: Avoid default browser styles. Use
bg-primary,text-muted-foreground, etc., from the theme. - Interactive: All interactive elements must have hover/active states and micro-animations.
- Accessible: Use semantic HTML and
focus-visiblestates. - Type-Safe: Use
cva(Class Variance Authority) for variant management.
Workflow
1. Component Structure
Create a new file in src/components/ui/ (or specific feature folder) using the assets/component.tsx template.
- Imports:
framer-motion,cn(clsx/tailwind-merge),cva. - Variants: Define visual styles using
cva. Avoid hardcoded colors (e.g.,bg-blue-500); use CSS variables (e.g.,bg-primary). - Animation: Wrap the root element in
motion.<element>and add subtleinitial/animateprops.
2. Styling Rules (Tailwind)
- Colors: Use semantic tokens:
primary,secondary,accent,muted,destructive. - Spacing: Use
gap-2,p-4, etc. - Borders:
border-input,border(1px default). - Radius:
rounded-mdorrounded-lg.
3. Usage Example
import { Component } from './Component';
export function Demo() {
return (
<Component variant="outline" size="lg">
Click Me
</Component>
);
}
Template
See assets/component.tsx for the full boilerplate.
// Quick Reference
const componentVariants = cva('base-classes...', {
variants: {
variant: { default: '...', outline: '...' },
size: { default: 'h-9 px-4', sm: 'h-8 px-3' },
},
defaultVariants: { variant: 'default', size: 'default' },
});
Checklist
- Used
cvafor variants - Added
framer-motionfor micro-interactions - Used semantic colors (not raw hex/names)
- Forwarded
refcorrectly - Exported
ComponentandcomponentVariants
Converted and distributed by TomeVault — claim your Tome and manage your conversions.