# <navigation-rail>

A vertical bar of destinations down the side of the screen, each with its own content panel.

Category: Navigation.

```ham
<screen>
    <main>
        <navigation-rail color="indigo"
                         label-type="all"
                         height="560">
            <rail-item icon="inbox"
                       label="Inbox">
                <column style="p-16 gap-8">
                    <text style="font-bold">Inbox</text>
                    <text>Sam: Lunch tomorrow?</text>
                    <text>Ana: Slides attached</text>
                </column>
            </rail-item>
            <rail-item icon="star"
                       label="Starred">
                <text>Starred</text>
            </rail-item>
            <rail-item icon="settings"
                       label="Settings">
                <text>Settings</text>
            </rail-item>
        </navigation-rail>
    </main>
</screen>
```

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

## Attributes

| Name | What it does | Default |
|---|---|---|
| `background-color` | Rail background. |  |
| `color` | Selected indicator color. |  |
| `extended` | Extended mode (labels beside the icons). | `false` |
| `height` | Total height in px. |  |
| `label-type` | Which items show labels. (all, selected, none) | `all` |
| `selected` | Initially selected index. | `0` |

## Readings

| Name | What it does |
|---|---|
| `index` | The selected item's position, from 0. |
| `label` | The selected item's label. |

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

- [`<rail-item>`](https://hypeapps.dev/docs/reference/rail-item.md): One destination in a navigation rail: an icon, a label and the content shown when it is picked.
- [`<column>`](https://hypeapps.dev/docs/reference/column.md): Stacks its children top to bottom, with a gap between them and an alignment across.
- [`<text>`](https://hypeapps.dev/docs/reference/text.md): A run of text; with @text it shows an expression that updates as its variables change.
- [`<bottom-nav-item>`](https://hypeapps.dev/docs/reference/bottom-nav-item.md): One item of a bottom navigation bar: an icon and label that load a page or run a statement.
- [`<bottom-navigation-bar>`](https://hypeapps.dev/docs/reference/bottom-navigation-bar.md): The tab bar along the bottom of a screen; each item swaps a page into the main area.
- [`<nav-item>`](https://hypeapps.dev/docs/reference/nav-item.md): The older spelling of a bottom navigation item: metadata the bar reads, not drawn by itself.
- [`<portal>`](https://hypeapps.dev/docs/reference/portal.md): A live window onto another page: blurred and dimmed under a glass rim, it opens to full screen on a tap.
- [`<tab>`](https://hypeapps.dev/docs/reference/tab.md): One pane of a tab bar: a label or icon in the bar, and content built the first time it is shown.

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