From bb4496c5256b941586c49d2b382fe184c942ba31 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 26 Nov 2026 13:27:50 -0800 Subject: [PATCH] Allow Button details to wrap at assigned widths --- crates/ui-widgets/src/buttons/button.rs | 32 +++++-- crates/ui-widgets/src/buttons/face.rs | 32 +++++-- crates/ui-widgets/tests/it/buttons.rs | 120 ++++++++++++++++++++++++ 3 files changed, 169 insertions(+), 15 deletions(-) diff --git a/crates/ui-widgets/src/buttons/button.rs b/crates/ui-widgets/src/buttons/button.rs index 10060b7bc1..b3b57bea7a 100644 --- a/crates/ui-widgets/src/buttons/button.rs +++ b/crates/ui-widgets/src/buttons/button.rs @@ -7,11 +7,11 @@ use crate::contract::{ }; use crate::display::{ChordWrite, DisplayWords, Kbd, Picture, Spinner}; use crate::list::ThumbAspect; -use crate::primitives::{HAlign, IconSpec, PaintShape}; +use crate::primitives::{HAlign, IconSpec, PaintShape, Wrap}; use crate::runtime::commands::{CommandRef, ResolvedCommand}; use crate::runtime::env::Label; use crate::style::{ComponentStyle, DataColor, FocusLook, IconLook, StyleColor, StyleCx, SurfaceLook, TextLook, TypeRole}; -use craft_behavior::{Insets, Metrics, PartKey, PointerButton, PressPhase, Sense}; +use craft_behavior::{Insets, Metrics, PartKey, PointerButton, PressPhase, Proposal, Sense}; use craft_host::target::Os; use craft_keymap::{Mods, Trigger}; use craft_theme::{ @@ -192,10 +192,14 @@ pub struct Button<'a> { /// that names an item at the reading start). #[prop] align: HAlign, - /// A muted caption-role second line, wrapped under the icon and label. The face grows to fit it. It is the - /// accessible description unless `description` is set. + /// A muted caption under the icon and label of an inline button. It is the accessible description unless + /// `description` is set. #[prop(into)] detail: Option