Card

GitHub

Convenience card wrapper with optional title, description, icon, action, and content sections.

Installation

bash
pnpm dlx shadcn@latest add @cs/card

Usage

tsx
import { Card } from "@/components/cs/card";
tsx
<Card
  title="Project overview"
  description="Updated a few minutes ago"
  action={<button type="button">Edit</button>}
>
  <p>Card content</p>
</Card>

Compact action card

A small card containing a flexible row of three actions.

tsx
import { Button } from "@/components/ui/button";
import { Card } from "@/registry/cs/ui/card";

export default function CardSmallPreview() {
  return (
    <Card small contentClassName="flex gap-2">

        <Button >Save</Button>
        <Button  variant="outline">
          Share
        </Button>
        <Button  >
          Delete
        </Button>

    </Card>
  );
}

API Reference

Card

Convenience card wrapper with optional title, description, icon, and action.

Props

NameTypeDefaultDescription
actionReactNode-Content displayed in the card header action area.
childrenReactNode-Content displayed in the card header action area.
contentClassNamestring-Additional CSS classes applied to the card content.
descriptionReactNode-Supporting text below the title.
headerClassNamestring-Additional CSS classes applied to the card header.
iconReactNode-Icon displayed before the title.
smallboolean-Reduces the card's vertical and horizontal padding.
titleReactNode-Card header title.

CardHeader

Card header that adapts its layout for an icon, description, and action.

Props

NameTypeDefaultDescription
childrenReactNode-Content displayed in the card header action area.
descriptionReactNode-Supporting text below the title.
iconReactNode-Icon displayed before the title.
title *ReactNode-Card header title.