From: Dominik Csapak <d.csapak@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [PATCH yew-widget-toolkit 1/3] widget: navigation drawer: add optional trailing element for menu items
Date: Thu, 18 Jun 2026 13:31:58 +0200 [thread overview]
Message-ID: <20260618113241.2140893-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260618113241.2140893-1-d.csapak@proxmox.com>
Sometimes it can be useful to show some element after the menu label,
e.g. a button/status indicator/etc. so add a simple html option to the
menu item.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/widget/nav/mod.rs | 5 +++++
src/widget/nav/navigation_drawer.rs | 2 ++
2 files changed, 7 insertions(+)
diff --git a/src/widget/nav/mod.rs b/src/widget/nav/mod.rs
index 48283c5..166ad26 100644
--- a/src/widget/nav/mod.rs
+++ b/src/widget/nav/mod.rs
@@ -49,6 +49,11 @@ pub struct MenuItem {
#[builder_cb(IntoEventCallback, into_event_callback, ())]
#[prop_or_default]
pub on_activate: Option<Callback<()>>,
+
+ /// An optional trailing element that comes after the label.
+ #[prop_or_default]
+ #[builder(IntoPropValue, into_prop_value)]
+ pub trailing: Option<Html>,
}
impl MenuItem {
diff --git a/src/widget/nav/navigation_drawer.rs b/src/widget/nav/navigation_drawer.rs
index 4f28516..0066c78 100644
--- a/src/widget/nav/navigation_drawer.rs
+++ b/src/widget/nav/navigation_drawer.rs
@@ -238,6 +238,8 @@ impl PwtNavigationDrawer {
)
// add memu label
.with_child(html! {<div class="pwt-text-truncate pwt-flex-fill">{&item.label}</div>})
+ // add the optional trailer
+ .with_optional_child(item.trailing.clone())
// add optional menu-open icon
.with_optional_child(is_menu.then(|| {
Container::from_tag("i")
--
2.47.3
next prev parent reply other threads:[~2026-06-18 11:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 11:31 [PATCH yew-widget-toolkit 0/3] navigation drawer improvements Dominik Csapak
2026-06-18 11:31 ` Dominik Csapak [this message]
2026-06-18 11:31 ` [PATCH yew-widget-toolkit 2/3] widget: navigation drawer: cleanup menu toggle Dominik Csapak
2026-06-18 11:32 ` [PATCH yew-widget-toolkit 3/3] widget: navigation drawer: fix typo in comment Dominik Csapak
2026-06-19 4:58 ` applied: [PATCH yew-widget-toolkit 0/3] navigation drawer improvements Dietmar Maurer
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=20260618113241.2140893-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