# Card

Groups related content with a subtle border, rounded corners and `md` padding. Card is a Box, so it takes every Box prop, renders on the server and keeps `as`. The caller supplies the heading and the actions.

```tsx
import { Card } from '@blocks/design-system'
```

## Usage

Put a heading and a native link or button inside the card. The card stays static; its link is the focus target, so keyboard and screen reader users meet one clear control per card.

**Example: Station results** (`examples/card/station-results.tsx`)

```tsx
import { BodySmall, Card, Grid, Heading, Link } from '@blocks/design-system'

const results = [
  { id: 'mount-hood', name: 'Mount Hood', detail: 'Oregon · 84 in of snow' },
  { id: 'alta', name: 'Alta', detail: 'Utah · 102 in of snow' },
]

export default function StationResults() {
  return (
    <Grid as="ul" columns={{ base: 1, sm: 2 }} gap="md" margin="none" padding="none" aria-label="Search results">
      {results.map((result) => (
        <Card as="li" key={result.id} dangerouslySetStyle={{ listStyle: 'none' }}>
          <Heading as="h3" fontSize="md">
            {result.name}
          </Heading>
          <BodySmall color="text-muted">{result.detail}</BodySmall>
          {/* The card is static; its link is the one focus target. */}
          <Link href={`#station-${result.id}`} aria-label={`Open ${result.name}`}>
            Open station
          </Link>
        </Card>
      ))}
    </Grid>
  )
}
```

## As an article

Render a self-contained item `as="article"` and name it with its heading.

**Example: Article card** (`examples/card/article-card.tsx`)

```tsx
import { Body, Button, Card, Heading, Stack } from '@blocks/design-system'

export default function ArticleCard() {
  return (
    <Card as="article" aria-labelledby="storm-title" maxWidth="sm">
      <Stack gap="sm">
        <Heading as="h3" id="storm-title" fontSize="lg">
          Storm cycle ending
        </Heading>
        <Body margin="none">Snowfall tapers by Thursday; winds stay strong on exposed ridges.</Body>
        <Stack direction="row" gap="sm" align="center">
          <Button as="a" href="#storm-forecast" size="sm" variant="primary">
            Read forecast
          </Button>
        </Stack>
      </Stack>
    </Card>
  )
}
```

## Borders and padding

`borderColor`, `borderWidth` and `borderStyle` take tokens; `borderRadius` and the Box padding props override the defaults.

**Example: Border options** (`examples/card/border-options.tsx`)

```tsx
import { Body, Card, Stack } from '@blocks/design-system'

export default function BorderOptions() {
  return (
    <Stack direction={{ base: 'column', sm: 'row' }} gap="md">
      <Card>
        <Body margin="none">Default</Body>
      </Card>
      <Card borderColor="accent" borderWidth="md">
        <Body margin="none">Selected</Body>
      </Card>
      <Card borderStyle="dashed" backgroundColor="bg-subtle" padding="lg">
        <Body margin="none">Drop files here</Body>
      </Card>
    </Stack>
  )
}
```

## Props

**`Card` props**

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `as` | `ElementType` | — | The element or component to render, e.g. `as={NextLink}`. |
| `borderColor` | `"text" \| "overlay" \| "bg" \| "bg-subtle" \| "surface" \| "surface-hover" \| "surface-active" \| "selected" \| "border-subtle" \| "border" \| "border-strong" \| "focus-ring" \| "accent" \| "accent-hover" \| "accent-fg" \| "accent-subtle" \| "accent-text" \| "danger" \| "danger-hover" \| "danger-fg" \| "danger-subtle" \| "danger-text" \| "warning" \| "warning-hover" \| "warning-fg" \| "warning-subtle" \| "warning-text" \| "success" \| "success-hover" \| "success-fg" \| "success-subtle" \| "success-text" \| "info" \| "info-hover" \| "info-fg" \| "info-subtle" \| "info-text" \| "text-muted"` | `border-subtle` | A color token for the border, e.g. `"border"`. |
| `borderRadius` | `"button" \| "circle" \| "sm" \| "md" \| "xl" \| "xxl" \| "xxxl" \| "none" \| "pill"` | `md` | A border radius token, e.g. `"md"`, `"pill"` or `"circle"`. |
| `borderStyle` | `"none" \| "solid" \| "dashed" \| "dotted"` | `solid` | The border line style. |
| `borderWidth` | `"sm" \| "md" \| "lg" \| "none"` | `sm` | A border width token: `none`, `sm`, `md` or `lg`. |

Also accepts [Box layout props](https://design-system.blocks-ui.com/components/box.md#props), [styling escape hatches](https://design-system.blocks-ui.com/components/box.md#escape-hatches), [margin props](https://design-system.blocks-ui.com/components/box.md#spacing) and [padding props](https://design-system.blocks-ui.com/components/box.md#spacing), and the native attributes of the element it renders.

## Accessibility

- Don’t make a whole card clickable with a handler on the container. Put a real link inside it, and give each card’s link a distinct name, as in “Open Alta”.
- Lists of cards are lists: render them `as="ul"` with `as="li"` cards.
