Menu
What can be done about one thing: a dropdown at the pointer or under a control on the desktop, a sheet from the foot of a phone.
Desktop
arkui::menu · arkui::context · arkui::panel




A right click opens a row's menu at the pointer (Anchor::Pointer); a control's menu, a dropdown, hangs under the control (Anchor::RightEdge).
Resting on an entry with a submenu shows it beside the entry; j, k, l, h and <Esc> walk the menu and its submenu.
arkui::menu
The dropdown: a title and entries, as wide as its longest entry, opened at the pointer or lined up under a control, with submenus beside it.
Menu::open(title, entries, cursor, window, anchor)Entry::run(glyph, label, msg), Entry::submenu(…)Anchor::{Pointer, RightEdge(x)}view(menu, focused, at, activate)Menu::submenu_origin, origin_for, height, width_forfit, right_aligned, submenu_heightMIN_WIDTH, MAX_WIDTH, SUBMENU_OVERLAP, DWELL
Rules
- A right click opens at the pointer; a control's menu opens at the control.
- As wide as its longest entry, within 198..=420: AppKit's rule.
- A submenu laps the parent by exactly its padding, so the lit row touches its edge.
- A submenu opens after a 200ms rest, not on the way past.
arkui::context
A menu, its submenu, or a picker alone, and the rules for them together: which one has the keys, the dwell, l in and h out, <Esc>.
Context::new()focus() -> Option<Layer>open_menu, close_menu, open_picker, close_pickerland(i), picker_at(i), tick(), chosen(), activate_picker()cancel(), travel(motion)Layer::{Menu, Picker}
Rules
- Closing a menu takes its submenu with it.
- An app refuses its rows' hover while a layer is up: a backdrop cannot swallow a hover.
arkui::panel
The shape every context window is: a bordered panel, a title, and fixed-height entries with a glyph column that is there whether or not it has a glyph.
panel(body, width)entry(glyph, label, trailing)title(label)label(body, lit)width_for(labels, min, max)chars(width, chrome)titled_height(rows)hang_above(right, bottom, w, h)PADDING, ENTRY, TITLE, ENTRY_CHAR, ENTRY_CHROME, EDGE, RADIUS
Rules
- Heights are declared constants: a panel is placed before iced lays it out.
Mobile
Asking for the latest capture…
Where
ui/Components.kt: SheetRow, MoreButton
How
- SheetRow(icon, label, onClick, trailing = {}, emphasis = false) is one entry of a sheet.
- MoreButton(about, origin, onMore) opens it from a row.
Nothing shared for this on iOS yet.