Raxol.UI.Components.Input.Checkbox (Raxol v2.6.0)

View Source

Checkbox component for toggling boolean values.

This component provides a selectable checkbox with customizable appearance and behavior. Fully supports style and theme props (with correct merging/precedence), implements robust lifecycle hooks, and supports accessibility/extra props.

Summary

Functions

Initializes the Checkbox component state from the given props.

Creates a new checkbox component with the given options. See init/1 for details.

Renders the Checkbox component using the current state and context.

Types

t()

@type t() :: %{
  id: String.t(),
  label: String.t(),
  checked: boolean(),
  on_toggle: function() | nil,
  disabled: boolean(),
  style: map(),
  theme: map(),
  tooltip: String.t() | nil,
  required: boolean(),
  aria_label: String.t() | nil,
  focused: boolean()
}

Functions

broadcast(msg)

command(cmd)

init(props)

@spec init(map() | keyword()) :: {:ok, t()}

Initializes the Checkbox component state from the given props.

mount(state)

Callback implementation for Raxol.UI.Components.Base.Component.mount/1.

new(opts \\ [])

@spec new(keyword()) :: t()

Creates a new checkbox component with the given options. See init/1 for details.

render(state, context)

@spec render(t(), map()) :: any()

Renders the Checkbox component using the current state and context.

schedule(msg, delay)

unmount(state)

Callback implementation for Raxol.UI.Components.Base.Component.unmount/1.

update(props, state)

Callback implementation for Raxol.UI.Components.Base.Component.update/2.