Thumbprint logo

Button Row

Consistent spacing between buttons

iOS (UIKit) is being deprecated

Thumbprint on iOS is transitioning from UIKit to SwiftUI, and this documentation is no longer being supported. Please refer to the SwiftUI documentation when available.

ButtonRow should be used to display two Buttons side-by-side. The ButtonRow should fill the readable content width of the screen, and its distribution should be used to define the layout of the buttons within it.

Distribution

A ButtonRow’s distribution determines both the size and position of its buttons. ButtonRow.Distribution is an enum with three cases:

Equal

Left & right buttons each use 50% of the total space.

Emphasis

Left button is given enough space to fit its content, and right button takes up the remaining space.

Minimal

Left & right buttons are each given enough space to fit their content, but with the additional restriction that the right button never be smaller than the left button.

Public API

public init(leftButton: Button, rightButton: Button, distribution: Button.Distribution = .emphasis)

Creates and returns a new button row with the specified buttons and distribution.

public let leftButton: Button

Button to be shown on the left, should typically have either a secondary or tertiary button style.

public let rightButton: Button

Button to be shown on the right, should typically have primary button style.

public var distribution: Button.Distribution

Enum specifying how the buttons should be distributed along the horizontal axis.