[pdm-devel] [PATCH yew-widget-toolkit v2 1/1] tab bar: make `TabBarItem::tip` work as intended
Shannon Sterz
s.sterz at proxmox.com
Tue Dec 16 15:38:55 CET 2025
previously setting a tooltip via the `tip()` function of an
`TabBarItem` had no effect. so actually render a tooltip with the
provided `VNode` as content if a tooltip is set on a `TabBarItem`
Signed-off-by: Shannon Sterz <s.sterz at proxmox.com>
---
src/widget/tab/tab_bar.rs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/widget/tab/tab_bar.rs b/src/widget/tab/tab_bar.rs
index d3de24f5..44fb9f39 100644
--- a/src/widget/tab/tab_bar.rs
+++ b/src/widget/tab/tab_bar.rs
@@ -8,7 +8,7 @@ use crate::dom::{element_direction_rtl, DomSizeObserver, IntoHtmlElement};
use crate::props::{IntoStorageLocation, StorageLocation};
use crate::state::{NavigationContext, NavigationContextExt, PersistentState, Selection};
use crate::web_sys_ext::{ResizeObserverBoxOptions, ResizeObserverOptions};
-use crate::widget::Container;
+use crate::widget::{Container, Tooltip};
use crate::{impl_class_prop_builder, impl_yew_std_props_builder, prelude::*};
use super::TabBarItem;
@@ -464,7 +464,7 @@ impl Component for PwtTabBar {
let aria_disabled = if disabled { "true" } else { "false" };
let style = format!("grid-column: {};", i + 1);
- html! {
+ let content = html! {
<a ref={active_ref} aria-disabled={aria_disabled} {style} {onclick} {onkeyup} class={nav_class} {tabindex}>
<span ref={size_ref}>
if let Some(class) = &panel.icon_class {
@@ -473,6 +473,12 @@ impl Component for PwtTabBar {
{panel.label.as_deref().unwrap_or("")}
</span>
</a>
+ };
+
+ if let Some(tip) = panel.tip.clone() {
+ Tooltip::new(content).rich_tip(tip).into()
+ } else {
+ content
}
})
.collect::<Html>();
--
2.47.3
More information about the pdm-devel
mailing list