Card

Renders a card component comprising a header, content section, and footer...

Loading...

Installation

npx shadcn@latest add @scrollxui/card 

Usage

import {
  Card,
  CardAction,
  CardContent,
  CardDescription,
  CardFooter,
  CardHeader,
  CardTitle,
} from '@/components/ui/card';
<Card>
  <CardHeader>
    <CardTitle>Card Title</CardTitle>
    <CardDescription>Card Description</CardDescription>
    <CardAction>Card Action</CardAction>
  </CardHeader>
  <CardContent>
    <p>Card Content</p>
  </CardContent>
  <CardFooter>
    <p>Card Footer</p>
  </CardFooter>
</Card>
<Card className='custom-card-style'>
  <CardHeader>
    <CardTitle>Custom Card</CardTitle>
    <CardDescription>This card has a custom style.</CardDescription>
    <CardAction>Card Action</CardAction>
  </CardHeader>
  <CardContent>
    <p>Additional content with custom styles.</p>
  </CardContent>
  <CardFooter>
    <Button variant='link'>Learn More</Button>
  </CardFooter>
</Card>

Changelog

24-09-2025, Added CardAction

  • Introduced a new CardAction component to place actions (buttons, links) in the CardHeader aligned to the top-right.
  • Minor updates to existing components to include data-slot attributes for consistent styling.

API Reference

Card

The Card component is used to create a customizable container with content sections such as title, description, and footer.

Props

PropertyTypeDefaultDescription
classNamestring—
Custom classes for styling.
...propsReact.HTMLAttributes<HTMLDivElement>—
All standard div props.
CardHeaderReact.ReactNode—
Header section.
CardTitleReact.ReactNode—
Title inside header.
CardDescriptionReact.ReactNode—
Description inside header.
CardActionReact.ReactNode—
Action (e.g., button) in header.
CardContentReact.ReactNode—
Main content area.
CardFooterReact.ReactNode—
Footer section.

Built withby Ahdeetai.