Button

A component that performs an action when it is tapped by a user.

Preview

Button Preview

Code Example

let model = ButtonVM {
  $0.title = "Continue"
  $0.color = .primary
  $0.isFullWidth = true
  $0.size = .large
}

API

ButtonVM Props

A model that defines the appearance properties for a button component.

NameTypeDefaultDescription
titleString""The text displayed on the button.
animationScaleAnimationScalemediumThe scaling factor for the button's press animation, with a value between 0 and 1.
colorComponentColor?nilThe color of the button.
cornerRadiusComponentRadiusmediumThe corner radius of the button.
fontUniversalFont?nilThe font used for the button's title text. If not provided, the font is automatically calculated based on the button's size.
isEnabledBooltrueA Boolean value indicating whether the button is enabled or disabled.
isFullWidthBoolfalseA Boolean value indicating whether the button should occupy the full width of its superview.
sizeComponentSizemediumThe predefined size of the button.
styleButtonStylefilledThe visual style of the button.

SUButton

public init(
  model: ButtonVM,
  action: @escaping () -> Void = {}
)

UKButton

Initializers

public init(
  model: ButtonVM,
  action: @escaping () -> Void = {}
)

Public Properties

NameTypeDescription
action() -> VoidA closure that is triggered when the button is tapped.
modelButtonVMA model that defines the appearance properties.

Public Subviews

NameTypeDescription
titleLabelUILabelA label that displays the title from the model.