import * as React from 'react'; import Box from '@mui/material/Box'; import Card from '@mui/material/Card'; import CardContent from '@mui/material/CardContent'; import Typography from '@mui/material/Typography'; import CardActionArea from '@mui/material/CardActionArea'; const cards = [ { id: 1, title: 'Plants', description: 'Plants are essential for all life.', }, { id: 2, title: 'Animals', description: 'Animals are a part of nature.', }, { id: 3, title: 'Humans', description: 'Humans depend on plants and animals for survival.', }, ]; function SelectActionCard() { const [selectedCard, setSelectedCard] = React.useState(0); return ( {cards.map((card, index) => ( setSelectedCard(index)} data-active={selectedCard === index ? '' : undefined} sx={{ height: '100%', '&[data-active]': { backgroundColor: 'action.selected', '&:hover': { backgroundColor: 'action.selectedHover', }, }, }} > {card.title} {card.description} ))} ); } export default SelectActionCard;