Raxol.UI.Components.Input.Checkbox (Raxol v0.2.0)

View Source

Checkbox component for toggling boolean values.

This component provides a selectable checkbox with customizable appearance and behavior.

Summary

Functions

Creates a new checkbox component with the given options.

Types

t()

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

Functions

new(opts \\ [])

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

Creates a new checkbox component with the given options.

Options

  • :id - Unique identifier for the checkbox
  • :label - Text to display next to the checkbox
  • :checked - Whether the checkbox is checked
  • :on_change - Function to call when the checkbox state changes
  • :disabled - Whether the checkbox is disabled
  • :theme - Theme overrides for the checkbox
  • :tooltip - Optional tooltip text
  • :required - Whether the checkbox is required
  • :aria_label - Accessibility label

Returns

A new checkbox component struct.