Card

Web/Mobile

A flexible container with header, content, and footer.

انتشار نسخه جدید
تغییرات شما آماده انتشار است. با یک کلیک منتشرش کنید.

Installation

pnpm dlx cubix-ui@latest add card

Usage

Import
import { RocketIcon } from "lucide-react"

import { Button } from "@/components/cubix/button"
import { Card, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/cubix/card"
Example
<Card className="w-full max-w-sm">
  <CardHeader>
    <CardTitle>انتشار نسخه جدید</CardTitle>
    <CardDescription>تغییرات شما آماده انتشار است. با یک کلیک منتشرش کنید.</CardDescription>
  </CardHeader>
  <CardFooter>
    <Button>
      <RocketIcon data-icon="inline-start" />
      انتشار
    </Button>
  </CardFooter>
</Card>

Composition

Build a card from these parts. CardAction is optional and sits at the inline-end of the header, so it moves to the left automatically in RTL layouts.

Structure
Card
├── CardHeader
│   ├── CardTitle
│   ├── CardDescription
│   └── CardAction
├── CardContent
└── CardFooter

Accessibility

Card is a plain layout container with no implicit role. When a card represents a standalone region, render it as a section or pass role="region" with aria-labelledby pointing at the title. Wrap form cards in a form element so Enter submits and the fields are grouped for assistive tech.

Examples

With form

Cards pair with Cubix fields and buttons for short forms.

ساخت پروژه
پروژه جدید خود را در چند ثانیه راه‌اندازی کنید.

Login

A sign-in card with email and password fields. The header link uses CardAction.

ورود به حساب
برای ادامه، ایمیل و رمز عبور خود را وارد کنید.

With action

Use CardAction for a control at the inline-end of the header.

اعلان‌ها
۳ پیام خوانده‌نشده دارید.

انتشار شما با موفقیت انجام شد.

With icon

Compose the header with any element - an icon bubble draws attention to the title.

طرح حرفه‌ای
دسترسی به همه کامپوننت‌ها و پشتیبانی اولویت‌دار.

Size

Set size="sm" for tighter spacing and a smaller title.

گزارش‌های زمان‌بندی‌شده
خلاصه هفتگی، بدون خروجی دستی.
  • زمان‌بندی روزانه یا هفتگی را انتخاب کنید.
  • برای کانال‌ها یا هم‌تیمی‌های مشخص ارسال کنید.
  • نمودارها، جدول‌ها و شاخص‌های کلیدی را اضافه کنید.

Image

Place an image or media block as the first child. The card rounds the top edge, and pt-0 drops the top padding.

دورهمی طراحی سیستم
توکن‌ها، baseها و رابط عامل هوشمند - یک جلسه عملی برای تیم‌های محصول.

Spacing

Override --card-spacing on the root for a larger inset. Use gap-0 when the header uses a border so dividers sit flush.

شرایط استفاده
پیش از پذیرش توافق‌نامه، شرایط را مرور کنید.

این شرایط استفاده شما از فضای کاری، اسناد مشترک و ابزارهای همکاری را تعیین می‌کند.

مسئولیت محتوای بارگذاری‌شده و دسترسی‌های تیم با شماست.

API Reference

Note: Parts render data-slot attributes (card, card-header, card-title, card-description, card-action, card-content, card-footer) for targeting in tests and parent selectors. Use the same props on Base UI, React Aria, and Radix.

Card

PropTypeDefaultDescription
size"default" | "sm""default"Spacing scale for the card. sm tightens padding, gaps, and title size.
classNamestring-Additional Tailwind classes merged with the component styles (last one wins). Use [--card-spacing:--spacing(n)] to override inset.
...propsReact.ComponentProps<'div'>-All native div attributes (role, id, aria-*, ...) are forwarded to the rendered element.

CardHeader

Title, description, and optional action. With CardAction it becomes a two-column grid.

PropTypeDefaultDescription
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).
...propsReact.ComponentProps<'div'>-All native div attributes are forwarded to the rendered element.

CardTitle

PropTypeDefaultDescription
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).
...propsReact.ComponentProps<'div'>-All native div attributes are forwarded to the rendered element.

CardDescription

PropTypeDefaultDescription
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).
...propsReact.ComponentProps<'div'>-All native div attributes are forwarded to the rendered element.

CardAction

Action slot at the inline-end of the header (button, badge, menu).

PropTypeDefaultDescription
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).
...propsReact.ComponentProps<'div'>-All native div attributes are forwarded to the rendered element.

CardContent

PropTypeDefaultDescription
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).
...propsReact.ComponentProps<'div'>-All native div attributes are forwarded to the rendered element.

CardFooter

Footer for primary and secondary actions.

PropTypeDefaultDescription
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).
...propsReact.ComponentProps<'div'>-All native div attributes are forwarded to the rendered element.