> ## Documentation Index
> Fetch the complete documentation index at: https://araf.badr.co.id/llms.txt
> Use this file to discover all available pages before exploring further.

# Card

> A flexible surface container for grouping related content — supports default, flat, hoverable, stat, and media variants.

## Overview

<div style={{padding:"28px 24px",background:"#f9fafb",borderRadius:"12px",border:"1px solid #e5e7eb",display:"flex",gap:"16px",flexWrap:"wrap",alignItems:"flex-start"}}>
  <div style={{background:"#fff",border:"1px solid #E5E7EB",borderRadius:"12px",boxShadow:"0px 1px 3px rgba(16,24,40,0.1)",padding:"20px",width:"180px",fontFamily:"Inter,sans-serif"}}>
    <div style={{fontSize:"13px",fontWeight:600,color:"#101828",marginBottom:"4px"}}>Team overview</div>
    <div style={{fontSize:"12px",color:"#667085",marginBottom:"12px"}}>Summary of active members.</div>
    <div style={{fontSize:"13px",color:"#344054",marginBottom:"12px"}}>12 members active this week.</div>
    <button style={{fontSize:"12px",color:"#344054",border:"1px solid #D0D5DD",borderRadius:"6px",padding:"5px 10px",background:"#fff",cursor:"pointer"}}>View all</button>
  </div>

  <div style={{background:"#F9FAFB",border:"none",borderRadius:"12px",padding:"20px",width:"180px",fontFamily:"Inter,sans-serif"}}>
    <div style={{fontSize:"13px",fontWeight:600,color:"#101828",marginBottom:"4px"}}>Flat card</div>
    <div style={{fontSize:"12px",color:"#667085"}}>Subtle container without elevation.</div>
  </div>

  <div style={{background:"#fff",border:"1px solid #E5E7EB",borderRadius:"12px",boxShadow:"0px 1px 3px rgba(16,24,40,0.1)",padding:"20px",width:"180px",fontFamily:"Inter,sans-serif"}}>
    <div style={{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}}>
      <div style={{width:"36px",height:"36px",borderRadius:"8px",background:"#EFF8FF",display:"flex",alignItems:"center",justifyContent:"center"}}>
        <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#0479CE" strokeWidth="2">
          <line x1="12" y1="1" x2="12" y2="23" />

          <path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" />
        </svg>
      </div>

      <span style={{fontSize:"11px",color:"#027A48",background:"#ECFDF3",border:"1px solid #ABEFC6",borderRadius:"20px",padding:"2px 8px",fontWeight:500}}>+12.5%</span>
    </div>

    <div style={{fontSize:"12px",color:"#667085",marginBottom:"2px"}}>Total Revenue</div>
    <div style={{fontSize:"22px",fontWeight:700,color:"#101828"}}>\$48,295</div>
  </div>
</div>

**Card** is a versatile surface container. It comes in several variants: **default** (border + shadow), **flat** (no shadow), **hoverable** (interactive), **stat** (KPI display), and **media** (image header).

***

## Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install @araf-ds/core
  ```

  ```bash yarn theme={null}
  yarn add @araf-ds/core
  ```

  ```bash pnpm theme={null}
  pnpm add @araf-ds/core
  ```
</CodeGroup>

***

## Usage

```tsx theme={null}
import {
  Card,
  CardContent,
  CardDescription,
  CardFooter,
  CardHeader,
  CardStat,
  CardTitle,
} from "@araf-ds/core"

export default function Example() {
  return (
    <Card>
      <CardHeader>
        <CardTitle>Team overview</CardTitle>
        <CardDescription>Summary of your active team members.</CardDescription>
      </CardHeader>
      <CardContent>
        <p>12 members active this week.</p>
      </CardContent>
      <CardFooter>
        <Button variant="outline" size="sm">View all</Button>
      </CardFooter>
    </Card>
  )
}
```

***

## Variants

### Default Card

The standard card with a `1px` border, light shadow, and `12px` border radius.

<div style={{padding:"24px",background:"#f9fafb",borderRadius:"12px",border:"1px solid #e5e7eb"}}>
  <div style={{background:"#fff",border:"1px solid #E5E7EB",borderRadius:"12px",boxShadow:"0px 1px 3px rgba(16,24,40,0.1)",padding:"20px",maxWidth:"320px",fontFamily:"Inter,sans-serif"}}>
    <div style={{fontSize:"14px",fontWeight:600,color:"#101828",marginBottom:"4px"}}>Team overview</div>
    <div style={{fontSize:"13px",color:"#667085",marginBottom:"12px"}}>Summary of your active team members.</div>
    <div style={{fontSize:"14px",color:"#344054",marginBottom:"16px"}}>12 members active this week.</div>
    <button style={{fontSize:"13px",color:"#344054",border:"1px solid #D0D5DD",borderRadius:"8px",padding:"7px 12px",background:"#fff",cursor:"pointer"}}>View all</button>
  </div>
</div>

```tsx theme={null}
<Card>
  <CardHeader>
    <CardTitle>Team overview</CardTitle>
    <CardDescription>Summary of your active team members.</CardDescription>
  </CardHeader>
  <CardContent>
    <p>12 members active this week.</p>
  </CardContent>
  <CardFooter>
    <Button variant="outline" size="sm">View all</Button>
  </CardFooter>
</Card>
```

### Flat Card

No shadow — use inside panels or sections that already have a container.

<div style={{padding:"24px",background:"#f9fafb",borderRadius:"12px",border:"1px solid #e5e7eb"}}>
  <div style={{background:"#F9FAFB",border:"1px solid #F2F4F7",borderRadius:"12px",padding:"20px",maxWidth:"320px",fontFamily:"Inter,sans-serif"}}>
    <div style={{fontSize:"14px",fontWeight:600,color:"#101828",marginBottom:"4px"}}>Flat card</div>
    <div style={{fontSize:"13px",color:"#667085"}}>Simple content in a flat, no-shadow container.</div>
  </div>
</div>

```tsx theme={null}
<Card variant="flat">
  <CardContent>
    Simple content in a flat container.
  </CardContent>
</Card>
```

### Hoverable (Clickable) Card

Adds a hover transition and cursor pointer — use for navigable cards.

<div style={{padding:"24px",background:"#f9fafb",borderRadius:"12px",border:"1px solid #e5e7eb"}}>
  <div style={{background:"#fff",border:"1px solid #D0D5DD",borderRadius:"12px",boxShadow:"0px 4px 12px rgba(16,24,40,0.08)",padding:"20px",maxWidth:"320px",fontFamily:"Inter,sans-serif",cursor:"pointer",transition:"box-shadow 0.2s"}}>
    <div style={{fontSize:"14px",fontWeight:600,color:"#101828",marginBottom:"4px"}}>Project Alpha</div>
    <div style={{fontSize:"13px",color:"#667085",marginBottom:"12px"}}>Due March 31</div>

    <div style={{height:"8px",background:"#E5E7EB",borderRadius:"4px",overflow:"hidden"}}>
      <div style={{height:"8px",background:"#0479CE",borderRadius:"4px",width:"65%"}} />
    </div>

    <div style={{fontSize:"12px",color:"#667085",marginTop:"4px"}}>65% complete</div>
  </div>
</div>

```tsx theme={null}
<Card variant="hover" onClick={() => navigate("/project/1")}>
  <CardHeader>
    <CardTitle>Project Alpha</CardTitle>
    <CardDescription>Due March 31</CardDescription>
  </CardHeader>
  <CardContent>
    <Progress value={65} />
  </CardContent>
</Card>
```

### Stat Card

Optimized layout for KPI metrics with trend indicators.

<div style={{padding:"24px",background:"#f9fafb",borderRadius:"12px",border:"1px solid #e5e7eb",display:"flex",gap:"12px",flexWrap:"wrap"}}>
  <div style={{background:"#fff",border:"1px solid #E5E7EB",borderRadius:"12px",boxShadow:"0px 1px 3px rgba(16,24,40,0.1)",padding:"20px",width:"180px",fontFamily:"Inter,sans-serif"}}>
    <div style={{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"}}>
      <div style={{width:"36px",height:"36px",borderRadius:"8px",background:"#EFF8FF",display:"flex",alignItems:"center",justifyContent:"center"}}>
        <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#0479CE" strokeWidth="2">
          <line x1="12" y1="1" x2="12" y2="23" />

          <path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" />
        </svg>
      </div>

      <span style={{fontSize:"11px",color:"#027A48",background:"#ECFDF3",border:"1px solid #ABEFC6",borderRadius:"20px",padding:"2px 8px",fontWeight:500}}>+12.5%</span>
    </div>

    <div style={{fontSize:"12px",color:"#667085",marginBottom:"2px"}}>Total Revenue</div>
    <div style={{fontSize:"24px",fontWeight:700,color:"#101828"}}>\$48,295</div>
  </div>

  <div style={{background:"#fff",border:"1px solid #E5E7EB",borderRadius:"12px",boxShadow:"0px 1px 3px rgba(16,24,40,0.1)",padding:"20px",width:"180px",fontFamily:"Inter,sans-serif"}}>
    <div style={{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"}}>
      <div style={{width:"36px",height:"36px",borderRadius:"8px",background:"#FEF3F2",display:"flex",alignItems:"center",justifyContent:"center"}}>
        <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#DC2626" strokeWidth="2">
          <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" />

          <circle cx="9" cy="7" r="4" />

          <path d="M23 21v-2a4 4 0 0 0-3-3.87" />

          <path d="M16 3.13a4 4 0 0 1 0 7.75" />
        </svg>
      </div>

      <span style={{fontSize:"11px",color:"#B42318",background:"#FEF3F2",border:"1px solid #FECDCA",borderRadius:"20px",padding:"2px 8px",fontWeight:500}}>−3.1%</span>
    </div>

    <div style={{fontSize:"12px",color:"#667085",marginBottom:"2px"}}>Active Users</div>
    <div style={{fontSize:"24px",fontWeight:700,color:"#101828"}}>3,842</div>
  </div>
</div>

```tsx theme={null}
<Card>
  <CardStat
    label="Total Revenue"
    value="$48,295"
    trend="positive"
    change={12.5}
    icon={<DollarSignIcon />}
  />
</Card>
```

### With Media

Attach an image or visual header above the card content.

<div style={{padding:"24px",background:"#f9fafb",borderRadius:"12px",border:"1px solid #e5e7eb"}}>
  <div style={{background:"#fff",border:"1px solid #E5E7EB",borderRadius:"12px",boxShadow:"0px 1px 3px rgba(16,24,40,0.1)",maxWidth:"280px",overflow:"hidden",fontFamily:"Inter,sans-serif"}}>
    <div style={{height:"120px",background:"linear-gradient(135deg,#EFF8FF 0%,#CDE4F5 50%,#0479CE 100%)",display:"flex",alignItems:"center",justifyContent:"center"}}>
      <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth="1.5">
        <rect x="3" y="3" width="18" height="18" rx="2" />

        <path d="m3 9 4-4 4 4 4-4 4 4" />

        <path d="M3 15h18" />
      </svg>
    </div>

    <div style={{padding:"16px"}}>
      <div style={{fontSize:"14px",fontWeight:600,color:"#101828",marginBottom:"4px"}}>Project name</div>
      <div style={{fontSize:"13px",color:"#667085"}}>Description of the project goes here.</div>
    </div>
  </div>
</div>

```tsx theme={null}
<Card>
  <div className="aspect-video w-full overflow-hidden rounded-t-xl">
    <img src="/thumbnail.jpg" alt="Project" className="w-full h-full object-cover" />
  </div>
  <CardHeader>
    <CardTitle>Project name</CardTitle>
  </CardHeader>
  <CardContent>Description here.</CardContent>
</Card>
```

***

## API Reference

### Card

<ParamField path="variant" type="string" default="default">
  Visual style. Values: `default` · `flat` · `hover`
</ParamField>

<ParamField path="onClick" type="() => void">
  Makes the card interactive. Automatically applies hover cursor and focus ring.
</ParamField>

<ParamField path="className" type="string">
  Additional class names for the card container.
</ParamField>

### CardFooter

<ParamField path="align" type="string" default="start">
  Footer content alignment. Values: `start` · `end` · `between`
</ParamField>

### CardStat

<ParamField path="label" type="string" required>
  The metric label text (e.g. "Total Revenue").
</ParamField>

<ParamField path="value" type="string | number" required>
  Primary metric value displayed prominently.
</ParamField>

<ParamField path="trend" type="string">
  Trend direction for color coding. Values: `positive` · `negative` · `neutral`
</ParamField>

<ParamField path="change" type="number">
  Percentage change value (e.g. `12.5` renders as `+12.5%`).
</ParamField>

<ParamField path="icon" type="ReactNode">
  Icon displayed in the stat card header area.
</ParamField>

***

## Accessibility

* Hoverable cards rendered with `onClick` should include a focusable element or use `role="button"` with `tabIndex={0}` and keyboard handler
* `CardTitle` renders as `<h3>` by default — adjust heading level with the `as` prop to maintain document heading hierarchy
* Media images inside cards must have descriptive `alt` text
* Avoid putting interactive elements inside a card that is itself clickable — this creates nested interactivity issues

***

## Do's & Don'ts

<CardGroup cols={2}>
  <Card title="Do" icon="check" iconType="solid" color="#16A34A">
    * Use `CardStat` for KPI displays — it provides consistent metric layout
    * Use `variant="hover"` only for cards that are genuinely navigable or clickable
    * Keep card content focused on a single topic or entity
    * Use `CardFooter align="between"` when you need both a label and an action button
  </Card>

  <Card title="Don't" icon="xmark" iconType="solid" color="#DC2626">
    * Don't nest a clickable card inside another clickable card
    * Don't use Card as a modal replacement — use `Modal` or `Sheet` instead
    * Don't use `variant="hover"` on non-interactive cards — it creates false affordance
    * Don't overload a card with too many actions — limit to 1–2 per card
  </Card>
</CardGroup>
