Components Overview
Matrix UI provides a comprehensive set of React components built with accessibility, performance, and developer experience in mind.
Component Philosophy
Every Matrix UI component follows these principles:
- Accessible by Default - WCAG AA compliant with full keyboard navigation
- Composable Architecture - Build complex UIs from simple primitives
- Server Component Ready - Optimized for Next.js App Router
- Type Safe - Full TypeScript support with strict typing
- Theme Aware - Automatic adaptation to theme changes
- Zero Runtime CSS - Tailwind CSS for optimal performance
Component Library
UI Components
Core user interface elements
Button
Interactive button with multiple variants
Badge
Display status or count indicators
Avatar
User profile images with fallback
Separator
Visual divider between content
Layout Components
Structure and organize your interface
Card
Container with header, content, and footer sections
Form Components
Input and data collection elements
Input
Text input field with validation support
Label
Form field labels with accessibility
Textarea
Multi-line text input
Checkbox
Toggle selection state
RadioGroup
Single selection from options
Switch
Toggle between on/off states
Select
Dropdown selection component
Navigation Components
Navigate and organize content
Tabs
Tabbed interface for content sections
Overlay Components
Floating and modal interfaces
Dialog
Modal dialog for focused interactions
DropdownMenu
Contextual menu with actions
Tooltip
Contextual information on hover
Feedback Components
User feedback and loading states
Alert
Important messages and notifications
Progress
Progress indicators for operations
Skeleton
Loading placeholder for content
Spinner
Animated loading indicator
Component Status
Stable
Production-ready components with stable APIs
Beta
Mostly stable but APIs might change slightly
Experimental
Early development, expect breaking changes
Import Pattern
All components can be imported from the main package:
import {
Button,
Card,
CardHeader,
CardTitle,
CardContent
} from '@matrix-ui/components'
Component Anatomy
Matrix UI components follow consistent patterns:
Simple Components
<Button variant="primary" size="lg">
Click me
</Button>
Compound Components
<Card>
<CardHeader>
<CardTitle>Title</CardTitle>
<CardDescription>Description</CardDescription>
</CardHeader>
<CardContent>
Content goes here
</CardContent>
<CardFooter>
Footer content
</CardFooter>
</Card>
Controlled Components
const [value, setValue] = useState('')
<Input
value={value}
onChange={(e) => setValue(e.target.value)}
placeholder="Controlled input"
/>
Styling Components
Components can be styled using multiple approaches:
Using className
<Button className="mt-4 w-full">
Full width button with margin
</Button>
Using style prop
<Card style={{ maxWidth: '400px' }}>
Limited width card
</Card>
Using CSS variables
/* Override component-specific tokens */
:root {
--button-height: 3rem;
--card-padding: 2rem;
}