⌂
›
Widgets
›
IconButton
IconButton
A compact icon action control with click handlers and optional selected state.
Example
icon_button(
icon: :add,
on_click: ->(_e) { page.update(status, value: "Added") }
)
Common properties
iconicon_coloricon_sizetooltipselectedselected_iconselected_icon_colorurlon_click
Usage
icon_button(
icon: "search",
tooltip: "Search",
on_click: ->(_e) { page.update(status, value: "Search pressed") }
)
Notes
- Ruflet accepts icon names as strings, symbols, and
Ruflet::MaterialIcons::* selected_iconis supported by the underlying control model- Use
url:to open a link through the clienturl_launcher; useon_click:
for application actions.
Complete API
Helpers
icon_button(icon = ..., **props)iconbutton(icon = ..., **props)
Accepted properties
adaptive— Adapts to the platform (Material/Cupertino) when true.align— Alignment of the control within its parent.alignment— Alignment of the content within the control.animate_align— Animates alignment changes.animate_margin— Animates margin changes.animate_offset— Animates offset changes.animate_opacity— Animates opacity changes.animate_position— Animates position changes.animate_rotation— Animates rotation changes.animate_scale— Animates scale changes.animate_size— Animates size changes.aspect_ratio— Width-to-height ratio to maintain.autofocus— Requests focus when first shown.badge— Badge drawn on the corner of the control.bgcolor— Background color.bottom— Bottom offset when positioned inside a stack.col— Responsive column span (1-12) per breakpoint.data— Arbitrary value you can attach to the control and read back in handlers.disabled— Disables interaction when true.disabled_color— Disabled color.enable_feedback— Plays touch feedback (sound/haptic) on interaction.expand— Fills the available space along the parent's main axis when true.expand_loose— Like expand, but only grows up to the child's natural size.focus_color— Color shown while focused.height— Fixed height in logical pixels.highlight_color— Highlight color.hover_color— Color shown while hovered.icon— Icon name shown by the control.icon_color— Color of the icon.icon_size— Sets the icon size property.key— Stable identity used to preserve state across rebuilds.left— Left offset when positioned inside a stack.margin— Outer spacing around the control.mouse_cursor— Cursor shown when hovering the control.offset— Translation offset applied to the control.opacity— Opacity from 0.0 (transparent) to 1.0 (opaque).padding— Inner spacing between the border and the content.right— Right offset when positioned inside a stack.rotate— Rotation applied to the control.rtl— Renders right-to-left when true.scale— Scale transform applied to the control.selected— Whether the control is selected.selected_icon— Selected icon.selected_icon_color— Selected icon color.size_change_interval— Throttle interval for on_size_change, in ms.size_constraints— Min/max size constraints.splash_color— Splash color.splash_radius— Splash radius.style— Style overrides for the control.tooltip— Text shown on hover/long-press.top— Top offset when positioned inside a stack.url— URL the control loads or links to.visible— Hides the control when false.visual_density— Compactness of the control's layout.width— Fixed width in logical pixels.
Events
on_animation_end— Fired when an animation completes.on_blur— Fired when the control loses focus.on_click— Fired when the control is clicked/tapped.on_focus— Fired when the control gains focus.on_hover— Fired when the pointer enters/leaves the control.on_long_press— Fired on a long press.on_size_change— Fired when the control's size changes.
Wire reference
- Family:
materials - Widget type:
iconbutton