Open In App

How to Create a Card in Material UI ?

To create a card in Material UI, you can use the ‘Card’ component along with other components like ‘CardHeader’, ‘CardContent’, and ‘CardActions’ to structure content. Customize it with styles and props for a sleek, responsive design that fits your application seamlessly.

Installation

npm install @mui/material @emotion/react @emotion/styled

The below table illustrates the terms alongside their descriptions.

Term Description
@mui/material Package containing Material UI components.
@emotion/react Required for styling components with Emotion.
@emotion/styled Required for styling components with Emotion.

Features

Example

import React from 'react';
import { Card, CardContent, Typography, Button } from '@mui/material';

function MyCard() {
return (
<Card elevation={3}>
<CardContent>
<Typography variant="h5" component="div">
Card Title
</Typography>
<Typography variant="body2">
This is a sample card content. You can add any text or components here.
</Typography>
<Button variant="contained" color="primary">
Learn More
</Button>
</CardContent>
</Card>
);
}

export default MyCard;
Article Tags :