Skip to main content

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​

Storybook

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​

VariantWhat it is
defaultMuted icons on nav-bg.
activeprimary fill.
badgeCount bubble.
tooltipName 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​

PropTypeDefaultDescription
items *IconRailItem[]—Icons and separators, in the sidebar's group order. Required.
activestringnoneLabel of the current item
showTipstringnoneForce one tooltip open, for docs
onNavigate(item: IconRailLink, event: MouseEvent<HTMLAnchorElement>) => voidnoneCalled when an item is clicked
inlinebooleanfalseRounded 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>
KindNameDescription
property / JSON attributeitemsIcons and separators, in the sidebar's group order. Required.
attributeactiveLabel of the current item; default none
attributeshow-tip / showTipForce one tooltip open, for docs; default none
attributeinlineRounded and bordered, for docs; default false
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
eventco-navigateCalled when an item is clicked; default none (React: onNavigate)