pub trait UiExt {
Show 66 methods
// Required methods
fn small_icon(&mut self, icon: &Icon) -> Response;
fn medium_icon(&mut self, icon: &Icon) -> Response;
fn large_icon(&mut self, icon: &Icon) -> Response;
fn icon_with_size(&mut self, icon: &Icon, size: f32) -> Response;
fn error_label(&mut self, text: impl Into<String>) -> Response;
fn warning_label(&mut self, text: impl Into<String>) -> Response;
fn success_label(&mut self, text: impl Into<String>) -> Response;
fn info_label(&mut self, text: impl Into<String>) -> Response;
fn muted_label(&mut self, text: impl Into<String>) -> Response;
fn subdued_label(&mut self, text: impl Into<String>) -> Response;
fn hint_label(&mut self, text: impl Into<String>) -> Response;
fn strong_label(&mut self, text: impl Into<String>) -> Response;
fn monospace_label(&mut self, text: impl Into<String>) -> Response;
fn code_label(&mut self, text: impl Into<String>) -> Response;
fn label_with_icon(
&mut self,
icon: &Icon,
text: impl Into<String>,
) -> Response;
fn clickable_label(&mut self, text: impl Into<String>) -> Response;
fn primary_button(&mut self, text: impl Into<String>) -> Response;
fn secondary_button(&mut self, text: impl Into<String>) -> Response;
fn danger_button(&mut self, text: impl Into<String>) -> Response;
fn icon_button(&mut self, icon: &Icon) -> Response;
fn icon_button_with_tooltip(
&mut self,
icon: &Icon,
tooltip: impl Into<String>,
) -> Response;
fn toggle_button(
&mut self,
selected: &mut bool,
text: impl Into<String>,
) -> Response;
fn selectable_label_with_icon(
&mut self,
selected: bool,
icon: &Icon,
text: impl Into<String>,
) -> Response;
fn selectable_value_ui<T: PartialEq + Clone>(
&mut self,
current: &mut T,
value: T,
text: impl Into<String>,
) -> Response;
fn radio_value_ui<T: PartialEq + Clone>(
&mut self,
current: &mut T,
value: T,
text: impl Into<String>,
) -> Response;
fn combo_select<T: PartialEq + Clone>(
&mut self,
id_salt: impl Hash + Debug,
value: &mut T,
options: impl IntoIterator<Item = T>,
display: impl Fn(&T) -> String,
) -> bool;
fn combo_select_width<T: PartialEq + Clone>(
&mut self,
id_salt: impl Hash + Debug,
value: &mut T,
options: impl IntoIterator<Item = T>,
display: impl Fn(&T) -> String,
width: f32,
) -> bool;
fn combo_str_select(
&mut self,
id_salt: impl Hash + Debug,
value: &mut String,
options: &[&str],
) -> bool;
fn combo_str_select_width(
&mut self,
id_salt: impl Hash + Debug,
value: &mut String,
options: &[&str],
width: f32,
) -> bool;
fn panel_content(&mut self, add_contents: impl FnOnce(&mut Ui));
fn section_header(&mut self, text: impl Into<String>);
fn section_label(&mut self, text: impl Into<String>) -> Response;
fn subsection(
&mut self,
text: impl Into<String>,
add_contents: impl FnOnce(&mut Ui),
);
fn list(&mut self, add_contents: impl FnOnce(&mut Ui));
fn right_aligned(&mut self, add_contents: impl FnOnce(&mut Ui));
fn scroll_vertical(&mut self, add_contents: impl FnOnce(&mut Ui));
fn separator_with_margin(&mut self, margin: f32);
fn spaced_separator(&mut self);
fn themed_separator(&mut self);
fn toolbar_separator(&mut self);
fn full_width(&self) -> f32;
fn space_xs(&mut self);
fn space_sm(&mut self);
fn space_md(&mut self);
fn space_lg(&mut self);
fn space_xl(&mut self);
fn space_xxl(&mut self);
fn small_space(&mut self);
fn medium_space(&mut self);
fn large_space(&mut self);
fn text_edit_singleline_ui(&mut self, text: &mut String) -> Response;
fn text_edit_multiline_ui(&mut self, text: &mut String) -> Response;
fn number_edit(&mut self, value: &mut f64) -> Response;
fn search_input(&mut self, query: &mut String) -> Response;
fn drag_value_f32(&mut self, value: &mut f32) -> Response;
fn drag_value_with_range(
&mut self,
value: &mut f32,
range: RangeInclusive<f32>,
) -> Response;
fn drag_angle(&mut self, radians: &mut f32) -> Response;
fn property_row(
&mut self,
label: impl Into<String>,
add_value: impl FnOnce(&mut Ui),
);
fn visible_rect(&self) -> Rect;
fn is_visible(&self) -> bool;
fn current_theme(&self) -> Theme;
fn is_dark_mode(&self) -> bool;
fn is_light_mode(&self) -> bool;
fn is_touch_mode(&self) -> bool;
fn min_touch_target(&self) -> f32;
fn pnl_color(&self, value: f64) -> Color32;
}Expand description
Extension trait for egui::Ui with convenience methods for common UI patterns.
Required Methods§
Sourcefn small_icon(&mut self, icon: &Icon) -> Response
fn small_icon(&mut self, icon: &Icon) -> Response
Render a small icon (16px)
Sourcefn medium_icon(&mut self, icon: &Icon) -> Response
fn medium_icon(&mut self, icon: &Icon) -> Response
Render a medium icon (20px)
Sourcefn large_icon(&mut self, icon: &Icon) -> Response
fn large_icon(&mut self, icon: &Icon) -> Response
Render a large icon (24px)
Sourcefn icon_with_size(&mut self, icon: &Icon, size: f32) -> Response
fn icon_with_size(&mut self, icon: &Icon, size: f32) -> Response
Render an icon at a specific size
Sourcefn error_label(&mut self, text: impl Into<String>) -> Response
fn error_label(&mut self, text: impl Into<String>) -> Response
Render an error label (red text)
Sourcefn warning_label(&mut self, text: impl Into<String>) -> Response
fn warning_label(&mut self, text: impl Into<String>) -> Response
Render a warning label (orange text)
Sourcefn success_label(&mut self, text: impl Into<String>) -> Response
fn success_label(&mut self, text: impl Into<String>) -> Response
Render a success label (green text)
Sourcefn info_label(&mut self, text: impl Into<String>) -> Response
fn info_label(&mut self, text: impl Into<String>) -> Response
Render an info label (blue text)
Sourcefn muted_label(&mut self, text: impl Into<String>) -> Response
fn muted_label(&mut self, text: impl Into<String>) -> Response
Render a muted/secondary label (subdued text)
Sourcefn subdued_label(&mut self, text: impl Into<String>) -> Response
fn subdued_label(&mut self, text: impl Into<String>) -> Response
Render a subdued label (alias for muted_label)
Sourcefn hint_label(&mut self, text: impl Into<String>) -> Response
fn hint_label(&mut self, text: impl Into<String>) -> Response
Render a hint label (small + weak, for column headers and auxiliary info)
Sourcefn strong_label(&mut self, text: impl Into<String>) -> Response
fn strong_label(&mut self, text: impl Into<String>) -> Response
Render a strong/bold label
Sourcefn monospace_label(&mut self, text: impl Into<String>) -> Response
fn monospace_label(&mut self, text: impl Into<String>) -> Response
Render a monospace label
Sourcefn code_label(&mut self, text: impl Into<String>) -> Response
fn code_label(&mut self, text: impl Into<String>) -> Response
Render a code-style label (monospace with background)
Sourcefn label_with_icon(&mut self, icon: &Icon, text: impl Into<String>) -> Response
fn label_with_icon(&mut self, icon: &Icon, text: impl Into<String>) -> Response
Render a label with an icon prefix
Sourcefn clickable_label(&mut self, text: impl Into<String>) -> Response
fn clickable_label(&mut self, text: impl Into<String>) -> Response
Render a clickable label (looks like link)
Render a primary button (high emphasis)
Render a secondary button (medium emphasis)
Render a danger button (destructive action)
Render an icon-only button
Render an icon button with tooltip
Render a toggle button
Sourcefn selectable_label_with_icon(
&mut self,
selected: bool,
icon: &Icon,
text: impl Into<String>,
) -> Response
fn selectable_label_with_icon( &mut self, selected: bool, icon: &Icon, text: impl Into<String>, ) -> Response
Render a selectable label with an icon
Sourcefn selectable_value_ui<T: PartialEq + Clone>(
&mut self,
current: &mut T,
value: T,
text: impl Into<String>,
) -> Response
fn selectable_value_ui<T: PartialEq + Clone>( &mut self, current: &mut T, value: T, text: impl Into<String>, ) -> Response
Render a selectable value (like radio button without the circle)
Sourcefn radio_value_ui<T: PartialEq + Clone>(
&mut self,
current: &mut T,
value: T,
text: impl Into<String>,
) -> Response
fn radio_value_ui<T: PartialEq + Clone>( &mut self, current: &mut T, value: T, text: impl Into<String>, ) -> Response
Render a radio-style value
Sourcefn combo_select<T: PartialEq + Clone>(
&mut self,
id_salt: impl Hash + Debug,
value: &mut T,
options: impl IntoIterator<Item = T>,
display: impl Fn(&T) -> String,
) -> bool
fn combo_select<T: PartialEq + Clone>( &mut self, id_salt: impl Hash + Debug, value: &mut T, options: impl IntoIterator<Item = T>, display: impl Fn(&T) -> String, ) -> bool
Combo box for selecting from typed options.
Replaces the 11-line ComboBox::from_id_salt → .show_ui → for … selectable_value pattern.
Returns true if the value changed.
let mut theme = "dark";
let names = egui_charts::theme::presets().map(|(name, _)| name);
let changed = ui.combo_select("theme", &mut theme, names, |n| n.to_string());Sourcefn combo_select_width<T: PartialEq + Clone>(
&mut self,
id_salt: impl Hash + Debug,
value: &mut T,
options: impl IntoIterator<Item = T>,
display: impl Fn(&T) -> String,
width: f32,
) -> bool
fn combo_select_width<T: PartialEq + Clone>( &mut self, id_salt: impl Hash + Debug, value: &mut T, options: impl IntoIterator<Item = T>, display: impl Fn(&T) -> String, width: f32, ) -> bool
Combo box for selecting from typed options with explicit width.
Sourcefn combo_str_select(
&mut self,
id_salt: impl Hash + Debug,
value: &mut String,
options: &[&str],
) -> bool
fn combo_str_select( &mut self, id_salt: impl Hash + Debug, value: &mut String, options: &[&str], ) -> bool
Combo box for selecting a String value from &str options.
let changed = ui.combo_str_select("condition", &mut condition, &["Crossing", "Greater Than", "Less Than"]);Sourcefn combo_str_select_width(
&mut self,
id_salt: impl Hash + Debug,
value: &mut String,
options: &[&str],
width: f32,
) -> bool
fn combo_str_select_width( &mut self, id_salt: impl Hash + Debug, value: &mut String, options: &[&str], width: f32, ) -> bool
Combo box for selecting a String value from &str options with explicit width.
Sourcefn panel_content(&mut self, add_contents: impl FnOnce(&mut Ui))
fn panel_content(&mut self, add_contents: impl FnOnce(&mut Ui))
Add content within a panel-style container
Sourcefn section_header(&mut self, text: impl Into<String>)
fn section_header(&mut self, text: impl Into<String>)
Render a section header
Sourcefn section_label(&mut self, text: impl Into<String>) -> Response
fn section_label(&mut self, text: impl Into<String>) -> Response
Render a small uppercase section label (e.g. “BALANCE”, “MARGIN”).
Sourcefn subsection(
&mut self,
text: impl Into<String>,
add_contents: impl FnOnce(&mut Ui),
)
fn subsection( &mut self, text: impl Into<String>, add_contents: impl FnOnce(&mut Ui), )
Render a subsection with collapsible header
Sourcefn list(&mut self, add_contents: impl FnOnce(&mut Ui))
fn list(&mut self, add_contents: impl FnOnce(&mut Ui))
Render content in a list-style container
Sourcefn right_aligned(&mut self, add_contents: impl FnOnce(&mut Ui))
fn right_aligned(&mut self, add_contents: impl FnOnce(&mut Ui))
Right-align content within the current horizontal layout.
Replaces ui.with_layout(Layout::right_to_left(Align::Center), |ui| { ... }).
Sourcefn scroll_vertical(&mut self, add_contents: impl FnOnce(&mut Ui))
fn scroll_vertical(&mut self, add_contents: impl FnOnce(&mut Ui))
Vertical scroll area that fills available space.
Replaces egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, ...).
Sourcefn separator_with_margin(&mut self, margin: f32)
fn separator_with_margin(&mut self, margin: f32)
Add a separator with margin
Sourcefn spaced_separator(&mut self)
fn spaced_separator(&mut self)
Add a separator with small spacing above and below, the usual section divider.
Sourcefn themed_separator(&mut self)
fn themed_separator(&mut self)
Add a horizontal separator with theme-appropriate color
Sourcefn toolbar_separator(&mut self)
fn toolbar_separator(&mut self)
Vertical separator for top toolbar 1px width, 20px height, 12px padding each side
Sourcefn full_width(&self) -> f32
fn full_width(&self) -> f32
Get full available width
Sourcefn small_space(&mut self)
fn small_space(&mut self)
Add small spacing (4px) - alias for space_sm
Sourcefn medium_space(&mut self)
fn medium_space(&mut self)
Add medium spacing (8px) - alias for space_lg
Sourcefn large_space(&mut self)
fn large_space(&mut self)
Add large spacing (12px) - alias for space_xl
Sourcefn text_edit_singleline_ui(&mut self, text: &mut String) -> Response
fn text_edit_singleline_ui(&mut self, text: &mut String) -> Response
Single-line text edit
Sourcefn text_edit_multiline_ui(&mut self, text: &mut String) -> Response
fn text_edit_multiline_ui(&mut self, text: &mut String) -> Response
Multi-line text edit
Sourcefn number_edit(&mut self, value: &mut f64) -> Response
fn number_edit(&mut self, value: &mut f64) -> Response
Number edit field
Sourcefn search_input(&mut self, query: &mut String) -> Response
fn search_input(&mut self, query: &mut String) -> Response
Search input with icon
Sourcefn drag_value_f32(&mut self, value: &mut f32) -> Response
fn drag_value_f32(&mut self, value: &mut f32) -> Response
Drag value for f32
Sourcefn drag_value_with_range(
&mut self,
value: &mut f32,
range: RangeInclusive<f32>,
) -> Response
fn drag_value_with_range( &mut self, value: &mut f32, range: RangeInclusive<f32>, ) -> Response
Drag value with range
Sourcefn drag_angle(&mut self, radians: &mut f32) -> Response
fn drag_angle(&mut self, radians: &mut f32) -> Response
Drag angle (radians, displayed as degrees)
Sourcefn property_row(
&mut self,
label: impl Into<String>,
add_value: impl FnOnce(&mut Ui),
)
fn property_row( &mut self, label: impl Into<String>, add_value: impl FnOnce(&mut Ui), )
Render a property row (label: value)
Sourcefn visible_rect(&self) -> Rect
fn visible_rect(&self) -> Rect
Get the visible rect
Sourcefn is_visible(&self) -> bool
fn is_visible(&self) -> bool
Check if the UI is visible
Sourcefn current_theme(&self) -> Theme
fn current_theme(&self) -> Theme
Get the current theme
Sourcefn is_dark_mode(&self) -> bool
fn is_dark_mode(&self) -> bool
Check if dark mode is active
Sourcefn is_light_mode(&self) -> bool
fn is_light_mode(&self) -> bool
Check if light mode is active
Sourcefn is_touch_mode(&self) -> bool
fn is_touch_mode(&self) -> bool
Check if touch input mode is active
Sourcefn min_touch_target(&self) -> f32
fn min_touch_target(&self) -> f32
Get minimum touch target size for current input mode
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".