Browse documentation
Docs/Overlays
Menus and dropdowns
Offer contextual commands, application menus, or a menu-backed choice.
Import
Load the optional component layer before using the examples below.
Menu bar and dropdown
A menu item pairs a label with an action; nil disables it.
Rendered example
Rendered by Zaniah's headless backend.
Ruby
open_file = ->(*) { puts "Open" }
Zaniah::UI::MenuBar.new([
["File", [["Open", open_file], ["Unavailable", nil]]]
])
Zaniah::UI::Dropdown.new("Choose",
items: [["First", 1], ["Second", 2]])
Accessibility
Menu items support arrows, Home, End, Enter, and Escape. Disabled commands remain visible.