[RFC PATCH yew-widget-toolkit 1/3] widget: button: add 'icon_style' property

Dominik Csapak
2026-03-20T16:08:34Z

so one can override the style of the icon, e.g. giving an explicit color
without having to create a CSS class for that.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/widget/button.rs | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/widget/button.rs b/src/widget/button.rs
index 584f923..85b9e9d 100644
--- a/src/widget/button.rs
+++ b/src/widget/button.rs
@@ -64,6 +64,11 @@ pub struct Button {
#[prop_or_default]
pub icon_class: Option<Classes>,

+ /// Icon CSS style.
+ #[prop_or_default]
+ #[builder(IntoPropValue, into_prop_value)]
+ pub icon_style: Option<AttrValue>,
+
/// Html tabindex attribute.
#[prop_or_default]
#[builder(IntoPropValue, into_prop_value)]
@@ -236,10 +241,11 @@ impl Component for PwtButton {
};

if let Some(icon_class) = &props.icon_class {
+ let style = props.icon_style.clone();
if !icon_class.is_empty() {
// Chromium fires onclick from nested elements, so we need to suppress that manually here
children.push(html!{
-
+
});
}
}
--
2.47.3