add muted_hover token and rework tab strip visuals

This commit is contained in:
2026-11-02 17:08:51 +07:00
parent 545d0986ed
commit f295b25366
10 changed files with 130 additions and 111 deletions
+15 -1
View File
@@ -41,6 +41,7 @@ pub struct Button {
size: Size,
disabled: bool,
tab_stop: bool,
debug_selector: Option<Rc<dyn Fn() -> String>>,
a11y_label: Option<SharedString>,
tooltip: Option<TooltipBuilder>,
on_click: Option<ClickHandler>,
@@ -60,6 +61,7 @@ impl Button {
size: Size::default(),
disabled: false,
tab_stop: true,
debug_selector: None,
a11y_label: None,
tooltip: None,
on_click: None,
@@ -102,6 +104,15 @@ impl Button {
self
}
/// Sets the debug-bounds selector, for headless tests.
pub fn debug_selector<F>(mut self, selector: F) -> Self
where
F: Fn() -> String + 'static,
{
self.debug_selector = Some(Rc::new(selector));
self
}
/// Renders the button inert, unfocusable, and dimmed.
pub fn disabled(mut self, disabled: bool) -> Self {
self.disabled = disabled;
@@ -160,7 +171,7 @@ impl RenderOnce for Button {
ButtonVariant::Ghost => (
None,
colors.foreground,
colors.muted,
colors.muted_hover,
ramps.secondary.pressed,
),
ButtonVariant::Destructive => (
@@ -173,6 +184,9 @@ impl RenderOnce for Button {
h_flex()
.id(self.id)
.when_some(self.debug_selector, |button, selector| {
button.debug_selector(move || selector())
})
.role(Role::Button)
.justify_center()
.when(icon_only, |button| button.size(metrics.control_height))