# <card>

A surface for grouped content, with padding, rounded corners and a soft shadow.

Category: Layout.

```ham
<card style="w-full">
    <img src="https://hypeapps.dev/gallery/assets/dish.jpg"
         style="w-full h-160 rounded-lg"
         fit="cover"/>
    <text style="font-bold mt-12">Lemon ricotta pasta</text>
    <text style="muted">20 minutes · serves 2</text>
</card>
```

How Hype Apps draws it on a phone: [light](https://hypeapps.dev/img/tags/card-light.webp), [dark](https://hypeapps.dev/img/tags/card-dark.webp).

## Attributes

| Name | What it does | Default |
|---|---|---|
| `color` | Background color (auto-contrasts text); a bg-* in style= wins. |  |
| `elevation` | Shadow depth as a number, mapped to shadow-*; a shadow-* in style= wins. |  |
| `radius` | Corner radius in px; a rounded-* in style= wins. |  |
| `variant` | Card style variant (elevated, filled, outlined) | `elevated` |

Any tag also takes gestures: `@on.tap`, `@on.longpress`, `@on.doubletap` and `@on.swipeleft` (and right, up and down). `@click` runs on a tap too.

## Guides and recipes that use it

- [Layout and styling](https://hypeapps.dev/docs/guides/layout.md)
- [A poll that syncs](https://hypeapps.dev/docs/guides/sync.md)
- [Who's using the app ($me)](https://hypeapps.dev/docs/guides/me.md)
- [Your own tags](https://hypeapps.dev/docs/guides/own-tags.md)

## Related tags

- [`<img>`](https://hypeapps.dev/docs/reference/img.md): Shows a picture from a URL or the app's files, sized and cropped by its style.
- [`<text>`](https://hypeapps.dev/docs/reference/text.md): A run of text; with @text it shows an expression that updates as its variables change.
- [`<address>`](https://hypeapps.dev/docs/reference/address.md): Contact details as a block, in italic by default, as HTML's address element.
- [`<aside>`](https://hypeapps.dev/docs/reference/aside.md): A side note set apart from the main text, as HTML's aside element; it works like a block.
- [`<background>`](https://hypeapps.dev/docs/reference/background.md): The layer a swiped dismissible row reveals behind it, such as a red delete strip.
- [`<block>`](https://hypeapps.dev/docs/reference/block.md): The general-purpose container: groups children and gives them padding, color, corners and a border.
- [`<center>`](https://hypeapps.dev/docs/reference/center.md): Centers its children and their lines of text, on both axes or only one.
- [`<col>`](https://hypeapps.dev/docs/reference/col.md): A box inside a row; its flex value sets its share of the row's width.

All tags: https://hypeapps.dev/docs/reference.md · The full reference: https://hypeapps.dev/llms.txt
