@@ -35,7 +35,7 @@ public struct PillOptions {
3535 public var minWidth : CGFloat = 50
3636
3737 /// Height of the pill
38- public var height : CGFloat = 15
38+ public var minHeight : CGFloat = 15
3939
4040 /// Radius of the enclosing view of each pill
4141 public var cornerRadius : CGFloat = 40
@@ -54,8 +54,11 @@ public struct PillOptions {
5454 /// Foreground color of a pill when it is not selected
5555 public var normalForegroundColor : Color = . white
5656
57- /// Padding of elements inside PillItem
58- public var padding : CGFloat = 2.5 // -> Custom changed
57+ /// Vertical padding of content inside a pill
58+ public var verticalPadding : CGFloat = 7.5
59+
60+ /// Vertical padding of content inside a pill
61+ public var horizontalPadding : CGFloat = 7.5
5962
6063 /// Whether pills should wrap to new line or not
6164 public var stackStyle : StackStyle = StackStyle . noWrap
@@ -139,18 +142,18 @@ public struct PillPickerView<T: Pill>: View {
139142public extension PillPickerView {
140143
141144 /// Set the background color for each pill when disabled
142- func pillDisabledBackgroundColor( _ value: Color ) -> PillPickerView {
143- var view = self
144- view. options. disabledBackgroundColor = value
145- return view
146- }
145+ func pillDisabledBackgroundColor( _ value: Color ) -> PillPickerView {
146+ var view = self
147+ view. options. disabledBackgroundColor = value
148+ return view
149+ }
147150
148- /// Set the foreground color for the title and icon in each pill when disabled
149- func pillDisabledForegroundColor( _ value: Color ) -> PillPickerView {
150- var view = self
151- view. options. disabledForegroundColor = value
152- return view
153- }
151+ /// Set the foreground color for the title and icon in each pill when disabled
152+ func pillDisabledForegroundColor( _ value: Color ) -> PillPickerView {
153+ var view = self
154+ view. options. disabledForegroundColor = value
155+ return view
156+ }
154157
155158 /// The foreground color used for the title
156159 /// and icon in each pill when not selected
@@ -199,10 +202,10 @@ public extension PillPickerView {
199202 return view
200203 }
201204
202- /// The height of each pill
203- func pillHeight ( _ value: CGFloat ) -> PillPickerView {
205+ /// The minimum height of each pill
206+ func pillMinHeight ( _ value: CGFloat ) -> PillPickerView {
204207 var view = self
205- view. options. height = value
208+ view. options. minHeight = value
206209 return view
207210 }
208211
@@ -228,10 +231,17 @@ public extension PillPickerView {
228231 return view
229232 }
230233
231- /// Padding of content inside each pill
232- func pillPadding ( _ value: CGFloat ) -> PillPickerView {
234+ /// Horizontal padding of content inside each pill
235+ func pillPaddingVertical ( _ value: CGFloat ) -> PillPickerView {
233236 var view = self
234- view. options. padding = value
237+ view. options. verticalPadding = value
238+ return view
239+ }
240+
241+ /// Horizontal padding of content inside each pill
242+ func pillPaddingHorizontal( _ value: CGFloat ) -> PillPickerView {
243+ var view = self
244+ view. options. horizontalPadding = value
235245 return view
236246 }
237247
@@ -328,8 +338,7 @@ struct PillView<T: Pill>: View {
328338 trailingIcon
329339 }
330340 }
331- . padding ( options. padding)
332- . frame ( minWidth: options. minWidth)
341+ . frame ( minWidth: options. minWidth, minHeight: options. minHeight)
333342 } )
334343 . buttonStyle (
335344 PillItemStyle (
@@ -413,14 +422,13 @@ struct PillItemStyle: ButtonStyle {
413422 let options : PillOptions
414423
415424
416-
417425 func makeBody( configuration: Configuration ) -> some View {
418426 configuration. label
419- . padding ( 12 )
427+ . padding ( . horizontal, options. horizontalPadding)
428+ . padding ( . vertical, options. verticalPadding)
420429 . background ( background)
421430 . foregroundColor ( foreground)
422431 . cornerRadius ( cornerRadius)
423-
424432 . overlay (
425433 RoundedRectangle ( cornerRadius: cornerRadius)
426434 . stroke ( borderColor, lineWidth: 1 )
0 commit comments