API reference

ButtonGroup Struct

Extends ViewComponentSerializable, FlexShapedComponent, Sendable
A horizontal group of Buttons rendered as a single WDS button group on the wearable.
Buttons in a group collapse to their icon until focused, so each button should carry an Button.iconName. Like FlexBox, a ButtonGroup accepts the layout-shape modifiers flexGrow(_:), flexShrink(_:), and alignSelf(_:) when it is a child of a FlexBox.

Signature

struct ButtonGroup: ViewComponentSerializable, FlexShapedComponent, Sendable

Constructors

init ( alignment , content )
Creates a button group with the buttons built using the result builder DSL.
Signature
public init( alignment: ButtonGroupAlignment,  content: () -> [Button])
Parameters
alignment: ButtonGroupAlignment  Alignment of the buttons within the group. Defaults to ButtonGroupAlignment.center.
content: () -> [Button]  A builder block for adding buttons.

Properties

Alignment of the buttons within the group.
alignSelf : Alignment?
Per-child cross-axis alignment override applied when this group is a child of a FlexBox.
buttons : [Button]
The buttons in this group.
flexGrow : Float
Flex-grow factor applied when this group is a child of a FlexBox.
flexShrink : Float
Flex-shrink factor applied when this group is a child of a FlexBox.

Functions

alignSelf ( value )
Overrides the cross-axis alignment for this button group.
Signature
public func alignSelf(_ value: Alignment) -> ButtonGroup
Parameters
_ value: Alignment
flexGrow ( value )
Sets the flex-grow factor for this button group.
Signature
public func flexGrow(_ value: Float) -> ButtonGroup
Parameters
_ value: Float
flexShrink ( value )
Sets the flex-shrink factor for this button group.
Signature
public func flexShrink(_ value: Float) -> ButtonGroup
Parameters
_ value: Float