From: Dietmar Maurer <dietmar@proxmox.com>
To: Dominik Csapak <d.csapak@proxmox.com>, yew-devel@lists.proxmox.com
Subject: Re: [RFC PATCH yew-widget-toolkit 1/3] widget: button: add 'icon_style' property
Date: Tue, 7 Apr 2026 10:54:30 +0200 [thread overview]
Message-ID: <970e19d3-593d-415b-b0de-6565eccd4942@proxmox.com> (raw)
In-Reply-To: <20260320160816.4113364-2-d.csapak@proxmox.com>
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!{
> - <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>
> });
> }
> }
next prev parent reply other threads:[~2026-04-07 8:54 UTC|newest]
Thread overview: 6+ 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 ` [RFC PATCH yew-widget-toolkit 1/3] widget: button: add 'icon_style' property Dominik Csapak
2026-04-07 8:54 ` Dietmar Maurer [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
2026-04-08 10:57 ` superseded: [RFC PATCH yew-widget-toolkit 0/3] implement " 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=970e19d3-593d-415b-b0de-6565eccd4942@proxmox.com \
--to=dietmar@proxmox.com \
--cc=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