add dock layout component

This commit is contained in:
2026-11-02 16:24:20 +07:00
parent 9bce2820cc
commit 545d0986ed
11 changed files with 1914 additions and 67 deletions
+11 -3
View File
@@ -40,6 +40,7 @@ pub struct Button {
variant: ButtonVariant,
size: Size,
disabled: bool,
tab_stop: bool,
a11y_label: Option<SharedString>,
tooltip: Option<TooltipBuilder>,
on_click: Option<ClickHandler>,
@@ -58,6 +59,7 @@ impl Button {
variant: ButtonVariant::default(),
size: Size::default(),
disabled: false,
tab_stop: true,
a11y_label: None,
tooltip: None,
on_click: None,
@@ -88,13 +90,19 @@ impl Button {
self
}
/// Sets the visual treatment.
/// Sets the button's visual language.
pub fn variant(mut self, variant: ButtonVariant) -> Self {
self.variant = variant;
self
}
/// Renders the button inert, unfocusable, and dimmed; disabled always wins.
/// Whether the button is a keyboard tab stop, dense toolbars turn it off.
pub fn tab_stop(mut self, tab_stop: bool) -> Self {
self.tab_stop = tab_stop;
self
}
/// Renders the button inert, unfocusable, and dimmed.
pub fn disabled(mut self, disabled: bool) -> Self {
self.disabled = disabled;
self
@@ -193,7 +201,7 @@ impl RenderOnce for Button {
button
.cursor_pointer()
.focusable()
.tab_stop(true)
.tab_stop(self.tab_stop)
.hover(move |style| style.bg(hover))
.active(move |style| style.bg(pressed))
.focus_visible(|style| style.shadow(focus_ring(colors.ring)))