From 94a505d20ec0fc978deba614900fb07f3a2c2127 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 15 Dec 2023 13:04:46 -0600 Subject: [PATCH] ensure any buttonBase in ButtonGroup is 1 line only Signed-off-by: Matt Bruce --- VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift b/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift index 665813b9..273f11ff 100644 --- a/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift +++ b/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift @@ -149,7 +149,15 @@ open class ButtonGroup: View { case .percentage(let value): percentage = value } } - buttons.forEach { if let width { ($0 as? Button)?.width = .value(width) } } + buttons.forEach { buttonBase in + //only allow 1 line for any button + buttonBase.titleLabel?.numberOfLines = 1 + buttonBase.titleLabel?.lineBreakMode = .byTruncatingTail + + if let width { + (buttonBase as? Button)?.width = .value(width) + } + } positionLayout.buttonPercentage = percentage collectionView.reloadData()