Components
Card
A flexible container component that provides a consistent card layout with support for various content types. Useful for displaying grouped information, content sections, or interactive elements with a unified visual style.
Props
children
: ReactNode - The content to be displayed within the cardas
: ElementType (optional) - The HTML element to render the card as (default: ‘div’)className
: string (optional) - Additional CSS classes to apply to the cardforceRounded
: boolean (optional) - Forces rounded corners on all screen sizesonClick
: MouseEventHandler (optional) - Click handler for interactive cards
Usage Examples
Basic Card
Custom Element Type
Interactive Card
With Custom Styling
Nested Cards
Styling
The component uses Tailwind CSS for styling and includes:
- Consistent border radius
- Light and dark theme support
- Border styling
- Background colors
- Responsive design
- Optional hover and active states
- Customizable padding and spacing
Best Practices
-
Content Structure:
- Use appropriate heading levels
- Maintain consistent padding
- Group related content
- Consider content hierarchy
-
Interaction Design:
- Use hover states for interactive cards
- Provide clear feedback for clickable cards
- Maintain accessibility when adding interactions
-
Layout Considerations:
- Use grid or flex layouts for card groups
- Consider responsive behavior
- Maintain consistent spacing between cards
Accessibility
- Semantic HTML structure
- Proper heading hierarchy
- Keyboard navigation support for interactive cards
- ARIA attributes when needed
- Color contrast compliance