Raxol.UI.Components.Modal (Raxol v0.5.0)
View SourceA modal component for displaying overlay dialogs like alerts, prompts, confirmations, and forms.
Summary
Functions
Creates props for an alert modal.
Creates props for a confirmation modal.
Creates props for a form modal.
Initializes the Modal component state from props.
Callback implementation for Raxol.UI.Components.Base.Component.mount/1
.
Creates props for a prompt modal.
Callback implementation for Raxol.UI.Components.Base.Component.unmount/1
.
Updates the Modal component state in response to messages. Handles show/hide, button clicks, and form updates.
Types
@type t() :: %Raxol.UI.Components.Modal{ buttons: list(), content: any(), form_state: map(), id: any(), style: map(), title: String.t(), type: atom(), visible: boolean(), width: non_neg_integer() }
State for the Modal component.
- :id - unique identifier
- :visible - whether the modal is visible
- :title - modal title
- :content - modal content (text or view elements)
- :buttons - list of {label, message} tuples
- :type - modal type (:alert, :confirm, :prompt, :form)
- :width - modal width
- :style - style map
- :form_state - state for prompt/form fields
Functions
Creates props for an alert modal.
Creates props for a confirmation modal.
Creates props for a form modal.
fields
should be a list of maps, each defining a form field:
%{id: :atom, type: :text_input | :checkbox | :dropdown, label: "string", value: initial_value, props: keyword_list, options: list, validate: regex | function}
(options only for dropdown)
Initializes the Modal component state from props.
Callback implementation for Raxol.UI.Components.Base.Component.mount/1
.
Creates props for a prompt modal.
Callback implementation for Raxol.UI.Components.Base.Component.unmount/1
.
Updates the Modal component state in response to messages. Handles show/hide, button clicks, and form updates.