TermUI.Widget.Button (TermUI v0.2.0)

View Source

An interactive button widget.

Button responds to Enter/Space keys when focused and mouse clicks. It displays visual feedback for different states.

Usage

Button.render(%{
  label: "Submit",
  on_click: fn -> send(self(), :submitted) end
}, state, area)

Props

  • :label - Button text (required)
  • :on_click - Callback function invoked on activation
  • :disabled - Whether button is disabled (default: false)
  • :style - Style options
  • :focused_style - Style when focused
  • :pressed_style - Style when pressed

Summary

Functions

Handles events for the button.

Handles messages to the button.

Initializes the button state.

Renders the button.

Functions

handle_event(arg1, state)

Handles events for the button.

handle_info(arg1, state)

Handles messages to the button.

init(props)

Initializes the button state.

render(state, area)

Renders the button.