Skip to content

Navigation rail group

Pro

A rail destination that opens a secondary column of links on hover or focus, and folds as an accordion in an expanded rail. Not an M3 component (@windmorph/react-pro).

import { NavigationRailGroup, NavigationRailGroupItem } from '@windmorph/react-pro';

Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.

Props

By name or description, across the 28 props below

NavigationRailGroup 19 props

  • idtype stringRequired

    Unique within the rail.

  • icontype ReactElement<unknown, string | JSXElementConstructor<any>>Required

    The destination's icon.

  • labeltype stringRequired

    The destination's label in the rail.

  • childrentype ReactNodeRequired

    NavigationRailGroupItem elements.

  • titletype ReactNodedefault label

    The title above the links (styled through classNames.heading).

  • hreftype stringdefault the first item's href

    Where the trigger goes.

  • currentPathtype string

    The current route: an item matching it by whole path segments is current.

  • pinnedtype booleandefault false

    While this group is current, its column stays open beside the rail.

  • opentype boolean

    Whether the column is open (controlled).

  • defaultOpentype booleandefault false

    Whether the column starts open (uncontrolled).

  • expandIcontype ReactNode

    Replaces the chevron of the accordion in an expanded rail.

  • openDelaytype numberdefault 60

    How long a mouse or pen rests on the trigger before the column opens, ms.

  • closeDelaytype numberdefault 250

    How long the column stays after a mouse or pen leaves, ms.

  • reftype Ref<HTMLDivElement>

    Ref to the outermost element.

Events

  • onOpenChangetype ((open: boolean) => void)

    Called when the column opens or closes.

Text

  • aria-labeltype stringdefault label

    The column's accessible name.

NavigationRailGroupItem 9 props

  • hreftype stringRequired

    Where the link goes.

  • childrentype ReactNodeRequired

    The link's text.

  • currenttype boolean

    Marks it current, whatever the group's currentPath says.

  • trailingtype ReactNode

    Content at the row's end, such as a badge.

  • disabledtype booleandefault false

    Whether the link can be followed.

  • reftype Ref<HTMLAnchorElement>

    Ref to the link.

  • idtype string

    The link's id.

Spec status

Not part of Material Design 3: a Windmorph Pro component, built on M3's colour roles, type scale, shapes and motion. Its variants and configurations each link to a live example.

  • A column that opens on hover or focus, or stays pinned (pinned)

    Built

    Configuration · Pinned

  • Folded as an accordion in an expanded rail

    Built

    Configuration · Expanded

Theming & tokens

Set the tokens below on the group or any ancestor. Its trigger is the core's NavigationRailItem, so the rail's own tokens paint it. Style each part with classNames: root, trigger, triggerIndicator, triggerIcon, triggerLabel, column, columnDivider, columnContent, heading, items, item, itemLabel, itemTrailing, accordion.

NavigationRailGroup tokens
VariableDefaultPaints
--wm-navigation-rail-group-column-width272pxThe secondary column’s width while open.
--wm-navigation-rail-group-column-top-inset0pxThe space between the rail’s top and the column’s.
--wm-navigation-rail-group-container-colorvar(--md-sys-color-surface-container)The column’s surface.
--wm-navigation-rail-group-end-cornervar(--md-sys-shape-corner-large)The corners on the column’s end edge.
--wm-navigation-rail-group-elevation2px 0 8px 0 color-mix(in srgb, var(--md-sys-color-shadow) 20%, transparent)The shadow on the panel’s end edge.
--wm-navigation-rail-group-elevation-rtl-2px 0 8px 0 color-mix(in srgb, var(--md-sys-color-shadow) 20%, transparent)The same shadow in right to left.
--wm-navigation-rail-group-divider-colorvar(--md-sys-color-outline-variant)The line between the rail and the column.
--wm-navigation-rail-group-heading-colorvar(--md-sys-color-on-surface-variant)The column’s heading.
--wm-navigation-rail-group-heading-padding16pxThe space around the column’s heading.
--wm-navigation-rail-group-items-padding8pxThe space around the column’s links.
--wm-navigation-rail-group-item-height48pxA link’s height at density 0; each density step takes 4px off.
--wm-navigation-rail-group-item-shapevar(--md-sys-shape-corner-full)A link’s corners.
--wm-navigation-rail-group-item-padding16pxThe space at a link’s sides.
--wm-navigation-rail-group-item-gap8pxThe space between a link’s label and what trails it.
--wm-navigation-rail-group-item-colorvar(--md-sys-color-on-surface-variant)A link’s text.
--wm-navigation-rail-group-item-current-container-colorvar(--md-sys-color-secondary-container)The current link’s fill.
--wm-navigation-rail-group-item-current-colorvar(--md-sys-color-on-secondary-container)The current link’s text.
--wm-navigation-rail-group-item-disabled-colorcolor-mix(in srgb, var(--md-sys-color-on-surface) calc(var(--md-sys-state-disabled-content-opacity) * 100%), transparent)A disabled link’s text.
--wm-navigation-rail-group-open-durationvar(--md-sys-motion-spring-spatial-default-duration)How long the column’s width and fade take to open.
--wm-navigation-rail-group-open-easingvar(--md-sys-motion-spring-spatial-default-easing)The curve of the column’s width and fade as it opens.
--wm-navigation-rail-group-close-durationvar(--md-sys-motion-spring-spatial-fast-duration)How long the column’s width and fade take to close.
--wm-navigation-rail-group-close-easingvar(--md-sys-motion-spring-effects-default-easing)The curve of the column’s width as it closes, which never overshoots.
--wm-navigation-rail-group-fade-durationvar(--md-sys-motion-spring-effects-default-duration)How long the column takes to fade under reduced motion.
--wm-navigation-rail-group-fade-easingvar(--md-sys-motion-spring-effects-default-easing)The curve of the column’s fade under reduced motion.
--wm-navigation-rail-group-switch-durationvar(--md-sys-motion-duration-short-3)How long a group’s links take to fade in as it takes the panel.
--wm-navigation-rail-group-switch-easingease-outThe curve of the links’ fade as a group takes the panel.
--wm-navigation-rail-group-accordion-insetvar(--m3-rail-item-inset, 20px)The space at the accordion’s sides in an expanded rail, which lines its icon up with the rail’s items.
--wm-navigation-rail-group-accordion-icon-gap12pxThe space between the icon and the label in an expanded rail.
--wm-navigation-rail-group-accordion-icon-size24pxThe icon in an expanded rail.
--wm-navigation-rail-group-accordion-label-colorvar(--md-comp-nav-rail-item-inactive-label-text-color, var(--md-sys-color-on-surface-variant))The label in an expanded rail, as the rail’s own item labels (their `--md-comp-nav-rail-item-inactive-label-text-color` when set).