IconRail
ComplexNavigation
<co-icon-rail>IconRail is the Focus Rail style's 64px slate icon rail with tooltips, leaving the most room for the chart.
import { IconRail } from 'health-components';
Examples
With Tooltip
Usage
<IconRail items={RAIL_ITEMS} active="Patients" />
When to use
- Focus Rail style on desktop.
When not to use
- Any place where labels must be visible for new staff: SidebarNav.
Variants and states
| Variant | What it is |
|---|---|
| default | Muted icons on nav-bg. |
| active | primary fill. |
| badge | Count bubble. |
| tooltip | Name on hover and focus. |
Accessibility
- Each item has aria-label; tooltips appear on focus too.
- Inactive icons use
nav-ink-muted(white at 72% on slate), 8.4:1.
Do and don't
- Do: Keep the same order as the sidebar groups, with separators between groups.
- Don't: More than about 12 icons.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
items * | IconRailItem[] | — | Icons and separators, in the sidebar's group order. Required. |
active | string | none | Label of the current item |
showTip | string | none | Force one tooltip open, for docs |
onNavigate | (item: IconRailLink, event: MouseEvent<HTMLAnchorElement>) => void | none | Called when an item is clicked |
inline | boolean | false | Rounded and bordered, for docs |
Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.
Angular, Vue and HTML
Register the elements once (Angular guide), then use <co-icon-rail>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.
Angular template
<co-icon-rail active="…" show-tip="…" [items]="items" (co-navigate)="onNavigate($event.detail)"></co-icon-rail>
| Kind | Name | Description |
|---|---|---|
| property / JSON attribute | items | Icons and separators, in the sidebar's group order. Required. |
| attribute | active | Label of the current item; default none |
| attribute | show-tip / showTip | Force one tooltip open, for docs; default none |
| attribute | inline | Rounded and bordered, for docs; default false |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| event | co-navigate | Called when an item is clicked; default none (React: onNavigate) |