From 039bbbdae8261bca58ffb449cf6dbb8960596ed1 Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Sat, 10 Oct 2026 07:26:43 +0700 Subject: [PATCH] Add icon position support to buttons --- crates/ui/src/button.rs | 47 ++++++++++++++++++++-- crates/workspace/src/dialogs/join_group.rs | 5 ++- crates/workspace/src/dialogs/new_chat.rs | 12 ++++-- crates/workspace/src/dialogs/new_group.rs | 5 ++- crates/workspace/src/dialogs/profile.rs | 18 ++++++--- crates/workspace/src/dialogs/relays.rs | 5 ++- crates/workspace/src/dialogs/restore.rs | 5 ++- crates/workspace/src/dialogs/screening.rs | 27 +++++++------ 8 files changed, 91 insertions(+), 33 deletions(-) diff --git a/crates/ui/src/button.rs b/crates/ui/src/button.rs index 352e79e5..53354930 100644 --- a/crates/ui/src/button.rs +++ b/crates/ui/src/button.rs @@ -106,6 +106,16 @@ pub trait ButtonVariants: Sized { } } +/// Which side of the label the icon sits on. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +pub enum IconPosition { + /// Left of the label. + #[default] + Start, + /// Right of the label. + End, +} + /// A Button element. #[derive(IntoElement)] #[allow(clippy::type_complexity)] @@ -125,6 +135,7 @@ pub struct Button { on_click: Option>, tab_stop: bool, selected: bool, + icon_position: IconPosition, } impl From