From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 3B55E1FF13F for ; Thu, 18 Jun 2026 13:32:46 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 89A8815CD3; Thu, 18 Jun 2026 13:32:45 +0200 (CEST) From: Dominik Csapak 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 Message-ID: <20260618113241.2140893-2-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260618113241.2140893-1-d.csapak@proxmox.com> References: <20260618113241.2140893-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.049 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [mod.rs] Message-ID-Hash: 33XQLQPABV2VEG4DIEZHBY6I2WAQH5YK X-Message-ID-Hash: 33XQLQPABV2VEG4DIEZHBY6I2WAQH5YK X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Yew framework devel list at Proxmox List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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>, + + /// An optional trailing element that comes after the label. + #[prop_or_default] + #[builder(IntoPropValue, into_prop_value)] + pub trailing: Option, } 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! {
{&item.label}
}) + // 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