Skip to main content

CamoNavigationRail

Concept​

1. Why​

On medium windows (tablets, foldables, small desktop windows), the top-level destinations move from a bottom bar to a vertical rail on the start edge. It uses the same CamoNavItem model as the bar (CamoNavigationBar), and CamoAdaptiveNavigation switches to it automatically.

2. Shape​

Material mapping preview: the M3 navigation rail. 80 wide, surface, the same pill indicator as the bar, labels below icons, and the header on top.

3. API​

Contract​

fun <T> CamoNavigationRail(
items: List<CamoNavItem<T>>, // 3–7
selected: T,
onSelect: (T) -> Unit,
header: Widget? = null, // e.g. CamoFab or a menu CamoIconButton
)

State → renderer: NavRailState(count, selectedIndex, interactions). The renderer reads showLabels and alignment from its style. Slots: header? and one NavItemSlot per item.

Tokens used​

The same as the navigation bar, with colors.surface as the container.

Component theme​

theme.components.navigationRail: NavigationRailTheme?. Every field is nullable in the theme. The skin's defaults(theme) fills whatever isn't set (Material defaults shown). See Theme §3.10.

FieldTypeMaterial defaultWhat it's for
indicatorNavIndicator (Pill | Line | Dot | Fill | None)Pillthe selected item's indicator. Line = a line on the start edge (Fluent, Carbon). Minimal: None. The size and shape fields apply to the chosen style.
alignmentRailAlignment (Top | Center)Topwhere the item group sits (ADR-23: only Material centers it)
showLabelsLabelVisibility (Always | Selected | Never)Alwayslabel visibility, an app-wide choice (ADR-23)
widthDp80rail width
itemSpacingDp12vertical gap between items
indicatorSizeSize56 × 32active pill
labelStyle / iconSizeCamoTextStyle / DplabelMedium / 24item content
colorsNavRailColors(container, indicator, selectedIcon, selectedLabel, icon, label)M3 valuesevery color it uses

Accessibility​

  • It's the same as the bar: a navigation landmark, items announced as tabs with position, and up/down arrows between items.
  • It respects the start inset (a landscape notch).

4. Build steps​

  1. CamoNavigationRail, NavigationRailRenderer, and the DebugSkin renderer.
  2. Tests: selection, arrows, header placement, alignment and showLabels from the theme, RTL (the rail moves to the right).

Done when

  • The adaptive sample shows the rail between 600 and 1200 with the header FAB.

5. Edge cases​

CaseDecided behavior
More items than fit verticallyThe item column scrolls. The header stays fixed.
Expanded rail (M3 2025, labels beside icons)Later. The drawer covers wide windows in v1.
RTLThe rail is on the right.
Changed in the M8 build (2026-11-01)
  • The rail's header is drawn by the renderer above the scrolling item column and stays fixed. RailAlignment.Center centers the group (Minimal and Fluent use Top). Minimal's rail has a hairline on the end edge; Fluent's is 48 wide, icons only, with a brand line on the start edge of the selected item.
  • Flutter: the rail has no SemanticsRole.tabBar. Flutter requires a tab bar's semantic children to all be tabs, and the rail's scroll view sits between them; its items are still tabs.

Implementation​

1. Why​

The vertical version of the navigation bar for medium windows. It reuses CamoNavItem and the item logic; Kotlin adds the start-edge insets (landscape cutouts), the scrolling item column with a fixed header, and vertical arrow keys.

2. Shape​

3. API​

@Composable
public fun <T> CamoNavigationRail(
items: List<CamoNavItem<T>>,
selected: T,
onSelect: (T) -> Unit,
modifier: Modifier = Modifier,
header: (@Composable () -> Unit)? = null,
)
  • Insets: windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Start + WindowInsetsSides.Vertical)); the rail's color runs under the cutout.
  • Alignment and labels: style.alignment (Top | Center) positions the item group with Arrangement.Top / Arrangement.Center; style.showLabels and style.indicator (Line = the start edge) as on the bar.
  • Keys: Up/Down move between items (roving focus), Enter/Space select.
  • Semantics: the same as the bar: a selectableGroup() of Role.Tab items.

4. Build steps​

  1. NavigationRailTheme / Style, CamoNavigationRail, the DebugSkin renderer.
  2. UI tests: selection; arrows; the header stays fixed while items scroll; RTL puts the rail on the right; landscape cutout inset on Android and iOS.

Done when

  • The adaptive sample shows the rail between 600 and 1200 dp with a header FAB.

5. Edge cases​

CaseDecided behavior
More items than fitThe item column scrolls; the header doesn't.
Expanded rail (labels beside icons)Later; the drawer covers wide windows.