LavaUI docs GitHub

struct Button

Swift

struct Button

A clickable control whose hover and press feedback is owned by the renderer.

Sources/LavaUI/Button.swift:4

Constructors

init(_ title: String, style: ButtonStyle = ButtonStyle(), font: UIFont? = nil, isEnabled: Bool = true, action: @escaping () -> Void)

Creates a button with a text label.

  • title: The label.
  • style: Colours and metrics; the default follows the current theme.
  • font: The label's font; nil uses the environment's.
  • isEnabled: Whether clicks call action.
  • action: Called on click.

Sources/LavaUI/Button.swift:23

Properties

var action: () -> Void

Called when the button is clicked. Not called while disabled.

Sources/LavaUI/Button.swift:8

var dumpDetail: String { get }

Not documented.

Sources/LavaUI/Button.swift:40

var font: UIFont?

The label's font, or nil to use the environment's font.

Sources/LavaUI/Button.swift:10

var isEnabled: Bool

Whether the button responds to clicks. A disabled button draws in the style's disabled colours.

Sources/LavaUI/Button.swift:14

var resolvedFont: UIFont? { get }

The font the label is drawn in: font, or the environment's when that is nil.

Sources/LavaUI/Button.swift:38

var style: ButtonStyle

Colours, corner radius and padding.

Sources/LavaUI/Button.swift:12

var title: String

The label drawn on the button.

Sources/LavaUI/Button.swift:6

Methods

func mountPrimitive() -> any AnyViewNode

Not documented.

Sources/LavaUI/Button.swift:42

func reconcilePrimitive(_ node: any AnyViewNode) -> any AnyViewNode

Not documented.

Sources/LavaUI/Button.swift:49