From 8e7ef5631e37f07f8999fc649f1450273c1af7c3 Mon Sep 17 00:00:00 2001 From: Floyd Wang Date: Wed, 12 Mar 2025 17:23:37 +0800 Subject: [PATCH] dropdown_button: Support `outline` style (#716) --- crates/ui/src/button/dropdown_button.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/ui/src/button/dropdown_button.rs b/crates/ui/src/button/dropdown_button.rs index 98abf765..a8f03899 100644 --- a/crates/ui/src/button/dropdown_button.rs +++ b/crates/ui/src/button/dropdown_button.rs @@ -21,6 +21,7 @@ pub struct DropdownButton { // The button props compact: Option, + outline: Option, variant: Option, size: Option, rounded: ButtonRounded, @@ -35,6 +36,7 @@ impl DropdownButton { popup_menu: None, compact: None, + outline: None, variant: None, size: None, rounded: ButtonRounded::Medium, @@ -63,6 +65,11 @@ impl DropdownButton { self.compact = Some(true); self } + + pub fn outline(mut self) -> Self { + self.outline = Some(true); + self + } } impl Styled for DropdownButton { @@ -104,6 +111,7 @@ impl RenderOnce for DropdownButton { bottom: true, }) .when_some(self.compact, |this, _| this.compact()) + .when_some(self.outline, |this, _| this.outline()) .when_some(self.size, |this, size| this.with_size(size)) .when_some(self.variant, |this, variant| this.with_variant(variant)), ) @@ -125,6 +133,7 @@ impl RenderOnce for DropdownButton { bottom_right: true, }) .when_some(self.compact, |this, _| this.compact()) + .when_some(self.outline, |this, _| this.outline()) .when_some(self.size, |this, size| this.with_size(size)) .when_some(self.variant, |this, variant| this.with_variant(variant)) .popup_menu_with_anchor(Corner::TopRight, move |this, window, cx| {