Raxol.UI.Components.Input.Button (Raxol v0.3.0)
View SourceButton component for interactive UI elements.
This component provides a clickable button with customizable appearance and behavior.
Summary
Functions
Handles input events for the button component.
Initializes the button component state.
Creates a new Button state map, applying defaults. Expects opts to be a Map.
Renders the button component based on its current state.
Updates the button component state based on external messages.
Types
@type t() :: %{ id: String.t(), label: String.t(), on_click: function() | nil, disabled: boolean(), focused: boolean(), theme: map(), style: map(), width: integer() | nil, height: integer() | nil, shortcut: String.t() | nil, tooltip: String.t() | nil, role: :primary | :secondary | :danger | :success | nil }
Functions
Handles input events for the button component.
Parameters
button
- The button componentevent
- The input event to handlecontext
- The event context
Returns
{:update, updated_button}
if the button state changed,
{:handled, button}
if the event was handled but state didn't change,
:passthrough
if the event wasn't handled by the button.
Initializes the button component state.
Creates a new Button state map, applying defaults. Expects opts to be a Map.
Renders the button component based on its current state.
Parameters
button
- The button component to rendercontext
- The rendering context
Returns
A rendered view representation of the button.
Updates the button component state based on external messages.