@akhatmirzo/ui

Card

A content block composed of Card.Header, Card.Body and Card.Footer that can also act as a link.

Buyurtma #1042

Bugun, 14:20

Yangi
Sarvar Abduxoliqov3 ta mahsulot · 245 000 so'm

Import

import { Card } from '@akhatmirzo/ui';

When to use

  • To group related information — an order, a product, a stat, a settings section.
  • Compose it: Card.Header (title, description, an action on the right), Card.Body and Card.Footer. All of them are optional.
  • If the whole card is clickable, pass an <a> or <button> with interactive and asChild — not a <div onClick>.
  • Don't nest cards. A Divider or some spacing is enough for inner grouping.

Variants

elevated (default) has a shadow and border and stands out on a white page. outline is just a border, good for dense lists. soft has no border and a surface-muted background.

Elevated

Soya va chegara (standart)

Outline

Faqat chegara

Soft

Och kulrang fon

Padding

padding: none is 0, sm 16px, md (default) 24px and lg 32px. The gap between sections scales with it.

sm · 16px
md · 24px
lg · 32px

With media

With padding="none" and overflow-hidden, an image runs to the card's edges and you add padding around the text yourself.

Samarqand bo'ylab sayohat

2 kun · 4 ta joy

Joy borGuruh

Clickable card

interactive raises the shadow on hover and shows a pointer cursor. It's styling only — for keyboard support, pass an <a> or <button> with asChild, so the card gets Tab focus and opens with Enter.

import Link from 'next/link';

<Card interactive asChild>
  <Link href="/reports/sales">
    <Card.Header title="Sales" description="October" />
  </Link>
</Card>;

Props

Card

Card accepts every other <div> attribute.

PropTypeDefaultDescription
variant'elevated' | 'outline' | 'soft''elevated'Look
padding'none' | 'sm' | 'md' | 'lg''md'Padding: 0 / 16 / 24 / 32px
interactiveboolean | nullfalseHover and focus styles (styling only)
asChildbooleanfalseRenders its child instead of its own element (e.g. <a>)

Card.Header

Also exported as CardHeader. Accepts the remaining <div> attributes; children render below the title and description.

PropTypeDefaultDescription
titleReactNode—Title (<h3>)
descriptionReactNode—Muted text under the title
actionReactNode—Element on the right: a badge, button or menu

Card.Body and Card.Footer

CardBody and CardFooter are plain <div>s that accept all their attributes. Body sets the text to text-sm; Footer lays its children out in a row with gap-2 (use className="justify-end" to push them right).

Data attributes

On the Card root: data-variant, data-padding and data-interactive. cardVariants is also exported if you need the styles on another element.

Accessibility

  • A plain <div> with no role. If it's a meaningful section, pass a <section> or <article> with asChild.
  • The Card.Header title is an <h3>. If that doesn't fit your page's heading order, put your own heading in children instead of title.
  • A clickable card only works from the keyboard when it's a real <a> / <button> via asChild; the focus ring then wraps the whole card.

On this page