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

Dietmar Maurer
2026-04-07T08:54:29Z

I don't really like this, because style is normally a HashMap. Maybe you
can find another way and do it with icon_class?

On 3/20/26 5:08 PM, Dominik Csapak wrote:
> 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!{
> -
> +
> });
> }
> }