Skip to main content

RtkButton

Overview

A button that follows RealtimeKit's Design System.

Topics:

Creating a button.

public init(style: Style = .solid, rtkButtonState: States = .active, size: Size = .large, appearance: RtkButtonAppearance = RtkButtonAppearanceModel())

Creates RtkButton for the Style States Size you passed.

Parameters:

Optional
style: passed any type of Style. Default value of style is solid.
rtkButtonState: passed any type of States. Default value of states is active.
size: passed any type of Size. Default value of size is large.
appearance: Any type which conforms to protocol RtkButtonAppearance

Style

public enum Style {
case solid
case line
case iconLeftLable(icon: RtkImage)
case iconRightLable(icon: RtkImage)
case text
case textIconLeft(icon: RtkImage)
case textIconRight(icon: RtkImage)
case iconOnly(icon: RtkImage)
case splitButton
}

States

public enum States
{
case active
case disabled
case hover
case focus
case pressed
}

Size

public enum Size {
case small
case medium
case large
}

For example we can use RtkButton as follows

let rtkImage = RtkImage(image:ImageProvider.image(named: "icon_down_arrow"))
let downloadButton: RtkButton = {
let button = RtkButton(style: .iconOnly(icon: rtkImage),
rtkButtonState: .active)
button.backgroundColor = rtkSharedTokenColor.background.shade800
button.isUserInteractionEnabled = false
button.tintColor = .white
// Set additional button properties if needed
button.selectedStateTintColor = DesignLibrary.shared.color.status.danger
return button
}()