Guide
Components
Card

Card Component

ℹ️

The Card component is a versatile React component designed to create customizable cards with different variants, headers, bodies, and actions. This component is inspired by the DaisyUI (opens in a new tab) framework's design for cards.

Example Preview

Card Component Preview

Usage

import { Card } from "@/@core";
 
// Example usage of Card component
const MyCard = () => {
  return (
    <Card
      className="bg-base-100 shadow-xl max-w-sm w-full"
      variant="normal"
      imageOverlay
    >
      {/* Card content goes here */}
    </Card>
  );
};
 
export default MyCard;

Props

Card Component Props

Prop NameTypeDefault ValueAllowed ValuesDescription
variantstring'normal''compact', 'normal'Specifies the variant of the card (compact or normal).
imageOverlaybooleanfalsetrue, falseAdds an image overlay effect to the card.
classNamestringundefinedAny valid class nameAdditional class names to customize the appearance of the card.
propsHTMLAttributesundefinedAny additional HTML attributesAny additional HTML attributes to be applied to the card component.
childrenReact.ReactNodeundefinedAny valid React nodeThe content to be rendered inside the card.

Card.Header Component Props

Prop NameTypeDefault ValueAllowed ValuesDescription
labelstring'h3''h1', 'h2', 'h3', 'h4', 'h5', 'h6'Specifies the heading level for the card header.
classNamestringundefinedAny valid class nameAdditional class names for the card header.
propsHTMLAttributesundefinedAny additional HTML attributesAny additional HTML attributes for the heading element.
childrenReact.ReactNodeundefinedAny valid React nodeThe content to be rendered inside the card header.

Card.Body Component Props

Prop NameTypeDefault ValueAllowed ValuesDescription
classNamestringundefinedAny valid class nameAdditional class names for the card body.
propsHTMLAttributesundefinedAny additional HTML attributesAny additional HTML attributes for the body element.
childrenReact.ReactNodeundefinedAny valid React nodeThe content to be rendered inside the card body.

Card.Actions Component Props

Prop NameTypeDefault ValueAllowed ValuesDescription
positionstring'right''left', 'right'Specifies the alignment of the card actions.
classNamestringundefinedAny valid class nameAdditional class names for the card actions.
propsHTMLAttributesundefinedAny additional HTML attributesAny additional HTML attributes for the actions container.
childrenReact.ReactNodeundefinedAny valid React nodeThe content to be rendered inside the card actions.

Examples

Example 1: Basic Card

import { Card } from "@/@core";
 
const MyCard = () => {
  return (
    <Card>
      <Card.Header>Card Title</Card.Header>
      <Card.Body>Card Content Goes Here</Card.Body>
      <Card.Actions>{/* Actions go here */}</Card.Actions>
    </Card>
  );
};
 
export default MyCard;

Example 2: Card with Variant

import { Card } from "@/@core";
 
const MyCard = () => {
  return (
    <Card variant="compact">{/* Card content for compact variant */}</Card>
  );
};
 
export default MyCard;

Example 3: Card with Image Overlay

import { Card } from "@/@core";
 
const MyCard = () => {
  return <Card imageOverlay>{/* Card content with image overlay */}</Card>;
};
 
export default MyCard;
ℹ️

Note: The Card component provides a visually appealing loading experience and is inspired by the DaisyUI (opens in a new tab) framework. Check it out for more awesome components.