Raxol.Components.Button (Raxol v0.3.0)

View Source

A customizable button component.

This module provides a more sophisticated button component than the basic button element, with support for various styles and behaviors.

Example

alias Raxol.Components.Button

Button.new("Save Changes", on_click: :save_clicked, style: :primary)

Summary

Functions

Creates a new button with the given label and options.

Renders the button as a basic element.

Types

t()

@type t() :: map()

Functions

new(label, opts \\ [])

Creates a new button with the given label and options.

Options

  • :on_click - Message to send when the button is clicked
  • :style - Button style (:primary, :secondary, :danger, :success, or a custom style map)
  • :disabled - Whether the button is disabled
  • :icon - Icon to display before the label
  • :full_width - Whether the button should take full width
  • :size - Button size (:small, :medium, :large)
  • :tooltip - Tooltip text to show on hover

Returns

A button component that can be used in a Raxol view.

Example

Button.new("Delete",
  on_click: {:delete, item_id},
  style: :danger,
  icon: :trash
)

render(button)

Renders the button as a basic element.

This is typically called by the renderer, not directly by users.