Expand description
IconButton — a square, icon-only, flat-surface button.
Five sizes covering both embedded use (inside another widget’s
trailing slot — TextInput’s clear-X, ComboBox’s chevron, SearchField’s
magnifier) and stand-alone use (toolbars, rich menus, hero CTAs).
The .embedded() flag opts into the JetBrains “built-in” look —
dimmer icon at rest (Secondary), brightening on hover (Primary),
flashing accent on press — so an IconButton living inside a TextInput
doesn’t compete visually with the field’s text. Without the flag the
icon stays at full visual weight (Primary at rest), the right default
for stand-alone toolbar / menu rows.
// Stand-alone toolbar use — full-weight icon.
let _w = IconButton::new(IconWidget::from_svg(MY_SVG))
.toolbar()
.tooltip(lit!("Save"))
.on_activate_fn(|ctx| ctx.send_intent(Intent::new("app.save")));
// Embedded inside a TextInput's trailing slot — dim until hover.
let _w = IconButton::clear()
.embedded()
.on_activate_fn(|ctx| ctx.send_intent(Intent::new("app.clear")));§Predefined constructors
Common roles ship with the appropriate icon and an i18n tooltip
(which doubles as the AT name). They are size- and mode-agnostic —
call .embedded(), .toolbar(), .large(), etc. to configure:
let _w = IconButton::browse().embedded(); // 24 dp, dim — TextInput trailing
let _w = IconButton::clear().embedded(); // 24 dp, dim — clear-X
let _w = IconButton::search().toolbar(); // 40 dp, full weight — toolbar
let _w = IconButton::visibility_toggle(visible); // password-field eye toggle§Bistate
Two distinct toggle modes:
IconButton::toggle— surface-tint bistate: clicking flips the boundSignal<bool>; whiletrue, the background reads asSurfaceRole::Selected(“on”). Same icon throughout. The pin-this-row / select-this-tool pattern.IconButton::toggle_with_icon— surface-tint and icon-swap bistate: same surface flip plus the icon glyph swaps to a second icon. The visibility-toggle pattern (eye ↔ eye-off).
§Slot convention
Host widgets that accept icon buttons follow the trailing_slot
convention established by TabWidget:
let _w = TextInput::new(value)
.trailing_slot(HStack::new().spacing(0.0)
.child(IconButton::clear().embedded().on_activate_fn(|ctx| ctx.send_intent(Intent::new("app.clear"))))
.child(IconButton::browse().embedded().on_activate_fn(|ctx| ctx.send_intent(Intent::new("app.browse"))))
);Structs§
- Built
InIcons - Icon factory set for predefined built-in buttons.
- Icon
Button - A square, icon-only, flat-surface button. See module docs for embedded vs stand-alone modes, the five sizes, and the two bistate toggle modes.
Enums§
- Icon
Button Size - Size variant for
IconButton. Seeteksilo_core::styles::IconButtonSizefor the canonical definition. Variants are calibrated to the IntelliJ Int UI scale (Compact 22 dp, Default 24 dp, Toolbar 30 dp, Large 40 dp, Hero 50 dp). Five sizes calibrated to the IntelliJ Int UI scale. Apps usually pick one per call; the active style maps each to a (square_size, icon_size) pair from its recipe.