Uqudo UIregistry

Card

Displays a card with header, content and footer.

Login to your account
Enter your email below to login to your account

Installation

npx shadcn@latest add @uqudo/card

Usage

import {
  Card,
  CardAction,
  CardContent,
  CardDescription,
  CardFooter,
  CardHeader,
  CardTitle,
} from "@/components/uqudo/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>

Every part is a plain <div>, so you can drop any of them. CardHeader is a grid: when it contains a CardAction, the action is placed in a second column aligned to the end, spanning the title and description rows.

Examples

Size

size="sm" tightens the padding and the gap between sections through the --card-spacing custom property.

Default
The regular card spacing.
Padding and gaps follow the default card spacing scale.
Small
Tighter spacing for dense layouts.
The sm size reduces padding and gaps in every section.

API Reference

Card

Prop

Type

Sub-components

All of them render a <div>, accept className and forward every other React.ComponentProps<"div">.

Componentdata-slotNotes
CardHeadercard-headerGrid container. Gets a second column when it contains a CardAction.
CardTitlecard-titleHeading font, text-base font-medium.
CardDescriptioncard-descriptionMuted text-sm copy.
CardActioncard-actionPlaced at the end of the header, spanning both rows.
CardContentcard-contentHorizontal padding only.
CardFootercard-footerflex items-center. Add border-t and it also gets top padding.

Data attributes

AttributeValue
data-slotcard on the root, see table above.
data-sizeThe resolved size on the root.

On this page