Skip to main content

Module multi_select

Module multi_select 

Source
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
MultiSelect
SelectNext
SelectPrevious

Enums§

Check
Whether a choice is on, for everything the picker is choosing for.
MultiSelectEvent
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::keys for layering over it or taking a chord away.
init
Install the bindings — bindings, bound. Call once, alongside crate::input::init.
tint
A colour for name, the same for the same name on every machine: an FNV-1a hash of its bytes into Theme::categorical.