⌂
›
Widgets
›
NavigationBar
NavigationBar
Bottom navigation control for switching between primary destinations.
Example
navigation_bar(
selected_index: 0,
destinations: [
navigation_bar_destination(icon: "home", label: "Home"),
navigation_bar_destination(icon: "settings", label: "Settings")
]
)
Common properties
destinationsselected_indexon_changebgcolorelevationindicator_colorlabel_behavior
Destination properties
navigation_bar_destination(...) commonly uses:
iconselected_iconlabel
Usage
navigation_bar(
selected_index: 0,
on_change: ->(e) { page.update(status, value: "Tab #{e.data}") },
destinations: [
navigation_bar_destination(icon: "home", selected_icon: "home", label: "Home"),
navigation_bar_destination(icon: "bookmark_border", selected_icon: "bookmark", label: "Saved")
]
)
Notes
- Ruflet supports icon name strings for both
iconandselected_icon - use
page.go(...)orpage.views = [...]in response to navigation changes
Complete API
Helpers
navigation_bar(**props, &block)navigationbar(**props, &block)
Accepted properties
adaptive— Adapts to the platform (Material/Cupertino) when true.align— Alignment of the control within its parent.animate_align— Animates alignment changes.animate_margin— Animates margin changes.animate_offset— Animates offset changes.animate_opacity— Animates opacity changes.animate_position— Animates position changes.animate_rotation— Animates rotation changes.animate_scale— Animates scale changes.animate_size— Animates size changes.animation_duration— Sets the animation duration property.aspect_ratio— Width-to-height ratio to maintain.badge— Badge drawn on the corner of the control.bgcolor— Background color.border— Border definition.bottom— Bottom offset when positioned inside a stack.col— Responsive column span (1-12) per breakpoint.data— Arbitrary value you can attach to the control and read back in handlers.destinations— The navigation destinations.disabled— Disables interaction when true.elevation— Shadow depth (z-height).expand— Fills the available space along the parent's main axis when true.expand_loose— Like expand, but only grows up to the child's natural size.height— Fixed height in logical pixels.indicator_color— Indicator color.indicator_shape— Sets the indicator shape property.key— Stable identity used to preserve state across rebuilds.label_behavior— Sets the label behavior property.label_padding— Label padding.left— Left offset when positioned inside a stack.margin— Outer spacing around the control.offset— Translation offset applied to the control.opacity— Opacity from 0.0 (transparent) to 1.0 (opaque).overlay_color— Overlay color.right— Right offset when positioned inside a stack.rotate— Rotation applied to the control.rtl— Renders right-to-left when true.scale— Scale transform applied to the control.selected_index— Sets the selected index property.shadow_color— Color of the drop shadow.size_change_interval— Throttle interval for on_size_change, in ms.surface_tint_color— Surface tint color.tooltip— Text shown on hover/long-press.top— Top offset when positioned inside a stack.visible— Hides the control when false.width— Fixed width in logical pixels.
Events
on_animation_end— Fired when an animation completes.on_change— Fired when the value changes.on_size_change— Fired when the control's size changes.
Wire reference
- Family:
materials - Widget type:
navigationbar