# Card

A box with a header (title, description and actions), a body and a footer, or a card that is one big link.

- **Use it for**: A box with a heading, actions, body and footer, or a whole-card link with href.
- **Not for**: Interactive controls inside a linked card. Try [Accordion](https://unseenui.com/components/accordion/), [Table](https://unseenui.com/components/table/).

## Installation

```bash
npm install @stackunseen/ui
```

## Parts

A section you fill with parts. Use only the ones you need.

```tsx
<Card>
  <Card.Header icon={<TimerIcon />} actions={<Button size="sm">Edit</Button>}>
    <Card.Title>Time saved</Card.Title>
    <Card.Description>When tool calls save you time</Card.Description>
  </Card.Header>
  <Card.Content><Numeric size="lg" value="11.4 h" qualifier="vs September" /></Card.Content>
  <Card.Section>By tool, in a panel one step inside the card</Card.Section>
  <Card.Footer>Updated today</Card.Footer>
</Card>
```

1. **`Card`**: The surface. With `href` the whole card is one link. Props: `href`, `external`.
2. **`Card.Header`**: Title and description, with an optional icon tile before them and actions beside them. Props: `icon`, `actions`, `actionsLabel`.
3. **`Card.Title`**: The heading; `as` sets its level. Props: `as`.
4. **`Card.Description`**: A line under the title.
5. **`Card.Content`**: The main content.
6. **`Card.Section`**: A panel one surface step inside the card, for figures or grouped controls.
7. **`Card.Footer`**: Actions or details at the bottom.

## Usage

```tsx
import { Card } from '@stackunseen/ui';
import '@stackunseen/ui/styles.css';

<Card><Card.Header><Card.Title>Component library</Card.Title><Card.Description>Reusable website and AI controls.</Card.Description></Card.Header><Card.Content>Explore the available components.</Card.Content></Card>
```

## Props

- `children` (`ReactNode (optional)`): Your content, with or without the supplied compound parts.
- `aria-labelledby` (`string (optional)`): Point to the title id when the section should be a named region.
- `className` (`string (optional)`): Add application styles to the section. Each compound part also accepts className.

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `external` | `boolean` | With href: opens in a new tab with rel="noreferrer" and says so to assistive technology. |
| `href` | `string` | Makes the whole card one link, for resources and related pages. |

## Keyboard

The card itself isn’t a tab stop; links and actions inside it follow the normal page order.

## Works with

[Table](https://unseenui.com/components/table/), [Tag](https://unseenui.com/components/tag/), [DiffStat](https://unseenui.com/components/diff-stat/), [ElapsedTime](https://unseenui.com/components/elapsed-time/), [Numeric](https://unseenui.com/components/numeric/), [Kbd](https://unseenui.com/components/kbd/), [DotRing](https://unseenui.com/components/dot-ring/), [DotBars](https://unseenui.com/components/dot-bars/), [WeekStrip](https://unseenui.com/components/week-strip/), [HeatKeys](https://unseenui.com/components/heat-keys/), [Sparkline](https://unseenui.com/components/sparkline/), [BarList](https://unseenui.com/components/bar-list/)

Page: https://unseenui.com/components/card/
