Skip to main content

Button

Button

Clickable control with focus, sizing, and events.

Quick Start

Tip: State and Events

Use view @state fields to drive text, colors, and visibility. Handle interactions via .onClick((event)).

How It Works

  • Text, icon, and background are composed internally.
  • Width/height auto-measure from text when set to 0.
  • OK key triggers .onClick when active; inactive buttons swallow OK.

Notable State Fields

  • text: string
  • isActive: boolean
  • isSelected: boolean
  • expandOnFocus: boolean (auto-collapse/expand)
  • iconUri: string
  • color, backgroundColor, iconColor
  • titleFontKey: string
  • width, height (layout)
  • onClick(event)

Event Type

type ButtonEvent = { view: ButtonView; type: 'click'; preventDefault: boolean };

API Reference

Button API