Expand description
egui’s small widgets drawn through the kit (docs/kit.md): a
checkbox, a radio button, a selectable row, a toggle chip, and the
arrow of a combo box; and an on/off Switch, which egui lacks.
Each keeps egui’s layout (egui’s atoms, sizes and spacing), its
interaction and what it tells assistive technology; the kit paints
the box (the checkbox, radio, selectable-row, toggle-chip and
combo-arrow components) and the marks are glyph roles (check,
indeterminate, radio, dropdown). A role’s default icon is drawn
with egui’s own geometry, so the default kit looks like egui; a kit
naming another icon gets that icon. They replace egui’s own:
| egui | egui-pop |
|---|---|
ui.checkbox(&mut on, text) | checkbox(ui, &mut on, text), or Checkbox |
ui.radio(on, text) | radio(ui, on, text), or RadioButton |
ui.radio_value(&mut v, x, text) | radio_value(ui, &mut v, x, text) |
ui.selectable_label(on, text) | selectable_label(ui, on, text), or SelectableRow |
ui.selectable_value(&mut v, x, text) | selectable_value(ui, &mut v, x, text) |
ComboBox::from_id_salt(id) | combo_box(id) |
ComboBox::new(id, label) | combo_box_labelled(id, label) |
| a selectable label used as a toggle | ToggleChip |
a checkbox drawn as a switch (egui’s demo toggle_switch) | switch(ui, &mut on, text), or Switch |
Splitter has no counterpart in egui, whose panels keep their
resize lines to themselves and out of the keyboard’s reach.
SortHeader, a column’s header, has none either. Nor has
Segmented, a row of exclusive options (a view’s modes, a tab strip),
which replaces a row of selectable_value buttons.
A combo box’s own box stays egui’s: it follows button through
egui’s Visuals (theme::visuals_with); only its arrow is the kit’s.
Re-exports§
pub use crate::segmented::SegmentOption;pub use crate::segmented::SegmentOverflow;pub use crate::segmented::Segmented;pub use crate::segmented::segment_fit;pub use crate::segmented::segment_step;
Structs§
- Checkbox
- A checkbox: its box is the kit’s
checkboxcomponent (selectedwhile checked), its mark thecheckglyph (indeterminatewhen so shown), in the state’stext, its label in thetextof the same state unchecked. egui’s [egui::Checkbox], drawn through the kit. - Radio
Button - A radio button: its circle is the kit’s
radiocomponent (selectedwhile chosen), its mark theradioglyph in the state’stext, its label in thetextof the same state unchosen. egui’s [egui::RadioButton], drawn through the kit. - Selectable
Row - A row picked from a short list: its box is the kit’s
selectable-rowcomponent,selectedfor the chosen one (neverhoverthen, so the choice stays visible under the pointer), its label in the state’stext. egui’sui.selectable_label(a selectable [egui::Button]), drawn through the kit, with egui’s padding and height. - Sort
Header - A column’s header: its box is the kit’s
table-header-cellcomponent,selectedwhile the rows are sorted by it, the direction the kit’ssort-ascendingorsort-descendingglyph after the title. A button for assistive technology, a label when it does not sort. The data table’s and the file picker’s. - Splitter
- The line between two panes side by side, in the room given to it: a
width in
value, changed by a drag, the left and right arrows while it has the keyboard (with Shift, by bigger steps), and given back to its default by a double click or Enter. - Switch
- An on/off switch: a track (the kit’s
switchcomponent,selectedwhile on) and a round thumb, at the track’s start while off and at its end while on, in the state’stext; its label after it, in thetextof the same state off. Laid out as a checkbox is (egui’s interaction height, the box’s side as the track’s height), clicked, or pressed with Space or Enter when focused, to toggle. A switch to assistive technology (AccessKit’sSwitchrole, toggled while on), named by its label or bySwitch::name. The thumb moves at once: no animation to wait for, none to turn off for reduced motion. - Toggle
Chip - A small toggle showing a short text or a glyph, on while
selected: its box is the kit’stoggle-chipcomponent (based onselectable-row), its text or glyph in the state’stext. It is a checkbox for assistive technology, named byToggleChip::name(else its text). The find bar’s case, whole word and regular expression options.
Functions§
- bar_
text_ button - A frameless text button sized for a bar: small text, no box, as wide as its text, egui’s hover look (its text brightens under the pointer) and the focus ring when it has the keyboard. A breadcrumb’s step, a profile’s name in a title bar, a job’s line in a status bar: a click target that must not look like a button among the bar’s text.
- checkbox
- A checkbox (
Checkbox):ui.checkbox, drawn through the kit. - combo_
box - egui’s [
ComboBox] with the kit’s arrow (paint_combo_arrow):ComboBox::from_id_salt. - combo_
box_ labelled - egui’s [
ComboBox] with a label and the kit’s arrow:ComboBox::new. - paint_
combo_ arrow - Paints a combo box’s arrow ([
ComboBox::icon]): the kit’scombo-arrowbox overrect,selectedwhile the list is open, then thedropdownglyph in itstext(the default icon with egui’s own geometry, a triangle as wide as egui’s). - radio
- A radio button (
RadioButton):ui.radio, drawn through the kit. - radio_
value - A radio button setting
currenttoalternativewhen clicked:ui.radio_value, drawn through the kit. - selectable_
label - A selectable row (
SelectableRow):ui.selectable_label, drawn through the kit. - selectable_
value - A selectable row setting
currenttovaluewhen clicked:ui.selectable_value, drawn through the kit. - switch
- A switch (
Switch): an on/off toggle with a track and a thumb.