From 53f3e77a5dcdc56b670b1b9986b63c84a8efd434 Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Sat, 1 Aug 2026 10:28:02 +0700 Subject: [PATCH] highlight active tab --- crates/ui/src/tab/mod.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crates/ui/src/tab/mod.rs b/crates/ui/src/tab/mod.rs index 0bf2665..9525f11 100644 --- a/crates/ui/src/tab/mod.rs +++ b/crates/ui/src/tab/mod.rs @@ -183,6 +183,7 @@ impl RenderOnce for Tab { .items_center() .flex_shrink_0() .h(TABBAR_HEIGHT) + .relative() .overflow_hidden() .text_color(fg) .text_sm() @@ -222,5 +223,21 @@ impl RenderOnce for Tab { this.on_click(move |event, window, cx| on_click(event, window, cx)) }) }) + .child( + div() + .absolute() + .bottom_0() + .left_0() + .right_0() + .h_0p5() + .when(self.selected && !self.disabled, |this| { + this.bg(cx.theme().element_active) + }) + .when(!self.selected && !self.disabled, |this| { + this.invisible().group_hover("", |this| { + this.visible().bg(cx.theme().secondary_background) + }) + }), + ) } }