# <attr>

Declares one prop of a tag of your own in full: its name, type and default value.

Category: Data.

```ham
<tag name="price-tag"
     amount="0.0">
    <attr name="currency"
          type="text"
          default="USD"/>
    <row style="gap-6 items-center">
        <text @text="$amount"
              style="font-bold text-xl"></text>
        <text @text="$currency"
              style="muted"></text>
    </row>
</tag>
<column style="gap-8">
    <price-tag amount="24.5"/>
    <price-tag amount="19.5"
               currency="EUR"/>
</column>
```

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

## Attributes

| Name | What it does | Default |
|---|---|---|
| `bind` | true makes the attribute two-way: the instance passes a $variable and a write to $name inside the body writes that variable. | `false` |
| `default` | The value when the instance gives none; empty without one. |  |
| `name` | The attribute's name ($name in the body). |  |
| `type` | What the attribute takes; a value of the wrong type warns and the default stands. (text, int, number, bool, color, style, url, command) | `text` |

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.

## Related tags

- [`<tag>`](https://hypeapps.dev/docs/reference/tag.md): Defines a tag of your own from built-in markup; every attribute but name is a prop with a default.
- [`<row>`](https://hypeapps.dev/docs/reference/row.md): Lays children side by side in one line; flex= shares the free space and align/cross position them.
- [`<text>`](https://hypeapps.dev/docs/reference/text.md): A run of text; with @text it shows an expression that updates as its variables change.
- [`<column>`](https://hypeapps.dev/docs/reference/column.md): Stacks its children top to bottom, with a gap between them and an alignment across.
- [`<slot>`](https://hypeapps.dev/docs/reference/slot.md): Marks where an instance's children go inside a user-defined tag; its own content is the fallback.

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