Overview
Cards are surfaces that display content and actions on a single topic. They should be easy to scan for relevant and actionable information. Elements like text and images should be placed on them in a way that clearly indicates hierarchy. Cards are commonly used for:- Displaying a collection of related information
- Entry points to more detailed information
- Containing different types of content (text, images, videos)
- Product listings and portfolios
- Dashboard widgets and summaries
Import
Basic Card
A simple card with content and actions.Card with Media
Cards can include images, videos, or other media content.Complex Interaction
A more complex card with multiple interaction areas.With Action Area
Make the entire card clickable using CardActionArea.Props
Card Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | The content of the card |
raised | boolean | false | If true, the card will use raised styling |
elevation | number | 1 | Shadow depth, accepts values between 0 and 24 (inherited from Paper) |
variant | 'elevation' | 'outlined' | 'elevation' | The variant to use (inherited from Paper) |
square | boolean | false | If true, rounded corners are disabled (inherited from Paper) |
sx | SxProps<Theme> | - | System prop for defining CSS styles |
component | ElementType | 'div' | The component used for the root node |
CardContent Props
Wrapper for card content with appropriate padding.| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | The content of the component |
component | ElementType | 'div' | The component used for the root node |
sx | SxProps<Theme> | - | System prop for defining CSS styles |
CardMedia Props
Display media (images, videos) within a card.| Prop | Type | Default | Description |
|---|---|---|---|
component | ElementType | - | The component used (e.g., ‘img’, ‘video’, ‘picture’) |
image | string | - | The image source URL (used as background-image if component is not img) |
src | string | - | The media source URL (when component is img, video, etc.) |
alt | string | - | Alternative text for accessibility |
height | number | string | - | The height of the media |
sx | SxProps<Theme> | - | System prop for defining CSS styles |
CardActions Props
Container for action buttons at the bottom of the card.| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | The action buttons |
disableSpacing | boolean | false | If true, removes the default spacing between buttons |
sx | SxProps<Theme> | - | System prop for defining CSS styles |
CardHeader Props
Display a header section with avatar, title, and actions.| Prop | Type | Default | Description |
|---|---|---|---|
avatar | ReactNode | - | The Avatar element to display |
title | ReactNode | - | The main title |
subheader | ReactNode | - | The subheader text |
action | ReactNode | - | Action element (e.g., IconButton) |
sx | SxProps<Theme> | - | System prop for defining CSS styles |
CardActionArea Props
Makes the entire card area clickable.| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | The content of the action area |
onClick | function | - | Click handler |
href | string | - | URL to navigate to when clicked |
sx | SxProps<Theme> | - | System prop for defining CSS styles |
Elevation and Variants
Cards support two variants:Accessibility
- Use semantic HTML when setting the
componentprop (e.g.,<Card component="article">) - Provide
alttext for CardMedia images - When using CardActionArea, ensure the action is keyboard accessible
- Use proper heading hierarchy in card titles
- Ensure sufficient color contrast for text content
Best Practices
- Content hierarchy - Use clear visual hierarchy with typography variants
- Consistent sizing - Keep cards in a grid or list at consistent sizes
- Limit actions - Don’t overwhelm users with too many actions per card
- Meaningful media - Use images that add value and context
- Responsive design - Adjust card layout for different screen sizes
- Loading states - Show skeleton or loading states for async content
- White space - Don’t overcrowd cards; let content breathe