# Card (card)

> Raised surface with a fine border, layered depth, and inset edge light.

- Entry: component
- Category: UI
- Preview capabilities: none (still preview)
- Runtime: React
- Needs Remotion: no
- QA page: https://jbm-ui.bns.studio/c/card
- JSON: https://jbm-ui.bns.studio/catalog/card.json
- Registry item: https://jbm-ui.bns.studio/r/card.json (source code in files[].content)

## Install

```sh
npx shadcn@latest add @jbm/card
```

Also installs @jbm/tokens (registry dependencies install automatically).

## Required setup

1. Add the `@jbm` registry to components.json (keep any entries already there):

   ```json
   {
     "registries": {
       "@jbm": "https://jbm-ui.bns.studio/r/{name}.json"
     }
   }
   ```

2. Map `@/*` to `./src/*` in tsconfig.json `compilerOptions.paths`, so `@/jbm/…` imports resolve to src/jbm/.

## Files

Each file's source code is in the registry item JSON (https://jbm-ui.bns.studio/r/card.json, files[].content).

| Source path | Installs to | Import |
| --- | --- | --- |
| `registry/jbm/ui/card.tsx` | `src/jbm/ui/card.tsx` | `@/jbm/ui/card` |

## API

### `Card` (component)

Card-stock (or dark) container with the shared surface border, card shadow, 28px radius, and 40px padding.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `React.ReactNode` | required | Card content. |
| `style` | `React.CSSProperties` | none | Inline styles merged last; use for width, height, or layout, not for new shadows. |
| `dark` | `boolean` | none | Uses the dark code-card fill with the dark border and shadow tokens. |

## Stage

fluid: Width fills its container and height follows the children. The card adds 40px padding and a 1px border on each side (82 stage pixels over the content); set style.width or style.height for a fixed box.

## Examples

### Dark card with a headline

```tsx
import { Card } from "@/jbm/ui/card"
import { color } from "@/jbm/lib/tokens"
import { Big } from "@/jbm/ui/big" // install @jbm/big separately

<Card dark><Big color={color.bg}>Surface</Big></Card>
```

## QA

- Compare the light and dark surfaces on cream: fine border, layered shadow, and the inset highlight on the upper edge.
- Check that content-driven height plus the 82px of padding and border still fits the safe area.

## Docs

- [Surface depth guide](https://jbm-ui.bns.studio/docs/surface-depth.md)

## Related

Installs:

- [Tokens (tokens)](https://jbm-ui.bns.studio/catalog/tokens.md)

Installed by:

- [StatCard (stat-card)](https://jbm-ui.bns.studio/catalog/stat-card.md)
- [CodeCard (code-card)](https://jbm-ui.bns.studio/catalog/code-card.md)

Imported in examples:

- [Big (big)](https://jbm-ui.bns.studio/catalog/big.md)

## More

- [llms.txt](https://jbm-ui.bns.studio/llms.txt): index of every item
- [catalog.json](https://jbm-ui.bns.studio/catalog.json): every item as JSON
- [Agent contract](https://jbm-ui.bns.studio/docs/agent-contract.md): what each field means
