Files
kryon/docs/navigation.md
waozi 216c190c43 Document only current Kryon APIs and website pages
Remove raylib paths, obsolete import and preview guidance, migration prose,
and orphaned documents/pages. Align widget imports, native ZX windows and
host contracts with the current implementation, and enforce current site routes.
2026-11-16 21:43:18 -03:00

1.5 KiB

Compact navigation

Navigation.Draw can compose a compact vertical rail or horizontal dock using the same themed buttons, keyboard activation and retained pointer capture as other Kryon controls.

Navigation :: #import "kryon/navigation";

props: Navigation.Props
props.key = KeyHash("navigation")
props.compact = true
props.vertical = true
props.bounds = Rectangle.{0.0, 0.0, 88.0, 720.0}
props.footer_count = 2
props.scroll_offset = navigation_scroll
result := Navigation.Draw(session, props, items[:])
navigation_scroll = result.scroll_offset

The last footer_count items stay at the bottom of a rail or the trailing edge of a dock. Other items scroll without covering those actions. Supply stable item keys when shortcuts can move. Items carry route IDs, labels, Image.Props, optional vector icon_shape, selected state and disabled state; the application applies result.clicked_route to its own routing.

Set draggable to receive result.drag, drag_route and drag_bounds for shortcut cards. While dragging a card, supply dragging and drag_position; drop_index reports the insertion slot among the scrolling shortcuts, or -1 outside their viewport. Footer actions are never insertion slots.

The surface resolves NavigationBar style rules and buttons resolve Navigation.NavigationBarItem rules. class_name and item_class_name let applications customize those faces with their current palette. Compact items use ordinary button hover, focus, press, selection and accessibility behavior.