Expand description
MultiSelect — Notion’s multi-select picker: names chosen from a shared
set, several at once, and the set managed in place.
The picker is the popover’s body, not its trigger: it renders its own
popover::popover_card and the host mounts it through one of
popover’s anchored layers, so one picker serves any trigger — a table
cell, a column heading, a toolbar button.
The host owns the data. Every event is a request, and the picker paints
what MultiSelect::set_choices last handed it.
ⓘ
ui::multi_select::init(cx); // once, at startup (with input::init)
let labels = cx.new(|cx| {
MultiSelect::new(choices, cx).with_create(normalize).with_manage()
});
cx.subscribe(&labels, |_, _, event, _| match event {
MultiSelectEvent::Toggled { name, on } => { /* apply or remove */ }
MultiSelectEvent::Dismissed => { /* close the popover */ }
_ => {}
})
.detach();Structs§
- Choice
- One name the picker offers.
- Confirm
- Dismiss
- Multi
Select - Rows show a check for on and a dash for mixed. Taking a row clears the query. The Create row sits first and is active while it shows. Escape in the manage pane returns to the list. The list shows twelve rows and scrolls past that.
- Select
Next - Select
Previous
Enums§
- Check
- Whether a choice is on, for everything the picker is choosing for.
- Multi
Select Event - What the picker asks of its host.
Constants§
- KEY_
CONTEXT - The key context the picker claims. It wraps its fields’ own context, so typing goes to a field while navigation keys fall through.
Functions§
- bindings
- The picker’s navigation keymap, as data — see
crate::keysfor layering over it or taking a chord away. - init
- Install the bindings —
bindings, bound. Call once, alongsidecrate::input::init. - tint
- A colour for
name, the same for the same name on every machine: an FNV-1a hash of its bytes intoTheme::categorical.