public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [RFC PATCH yew-widget-toolkit 1/3] widget: button: add 'icon_style' property
Date: Fri, 20 Mar 2026 17:03:58 +0100	[thread overview]
Message-ID: <20260320160816.4113364-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260320160816.4113364-1-d.csapak@proxmox.com>

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!{
-                    <span onclick={suppress_onclick.clone()}><i role="none" class={icon_class.clone()}></i></span>
+                    <span onclick={suppress_onclick.clone()}><i role="none" {style} class={icon_class.clone()}></i></span>
                 });
             }
         }
-- 
2.47.3





  reply	other threads:[~2026-03-20 16:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-20 16:03 [RFC PATCH yew-widget-toolkit 0/3] implement pie chart widget Dominik Csapak
2026-03-20 16:03 ` Dominik Csapak [this message]
2026-03-20 16:03 ` [RFC PATCH yew-widget-toolkit 2/3] macros: widget: impl WidgetStyleBuilder for svgs Dominik Csapak
2026-03-20 16:04 ` [RFC PATCH yew-widget-toolkit 3/3] add pie chart widget Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260320160816.4113364-2-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=yew-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal