Skip to main content

Card Component

Description​

The Card component is a versatile container that can display structured content, such as headers, actions, and clickable areas.

Props​

Card​

PropTypeDefaultDescription
isSelectedbooleanfalseAdds a selected state style to the card.

CardHeader​

PropTypeDefaultDescription
titlestring""The title displayed at the top of the card.
actionReactNodenullAdditional action elements (e.g., buttons).

CardContent​

PropTypeDefaultDescription
childrenReactNodenullContent inside the card body.

CardActionArea​

PropTypeDefaultDescription
onClick() => voidundefinedCallback when the area is clicked.
disabledbooleanfalseDisables the action area.
hrefstring""Optional link instead of a button.
target"_blank" , "_self" , "_parent" , "_top"undefinedSpecifies how the link opens.

CardActions​

PropTypeDefaultDescription
justifyContent"flex-start" , "center" , "flex-end" , "space-between""flex-end"Controls the alignment of action buttons.

Example Usage​

import { Card, CardHeader, CardContent, CardActionArea, CardActions, Button } from "@nomana-it/liberty-core"

export const CardExample = () => {
return (
<Card isSelected={true}>
<CardHeader title="Card Title" action={<Button variant="text">Edit</Button>} />
<CardContent>
This is the content inside the card. You can add text, images, or other elements here.
</CardContent>
<CardActionArea onClick={() => alert("Card Clicked!")}>
Clickable Area
</CardActionArea>
<CardActions>
<Button variant="contained" onClick={() => alert("Action Clicked!")}>Action</Button>
</CardActions>
</Card>
);
};

🔗 GitHub Repository (Core): Liberty Core
🔗 GitHub Repository (Test Project): Liberty Test
📖 Live Documentation: Liberty Core Docs
💖 Sponsor & Support: Sponsor Liberty Core