Raxol.Components.Modal (Raxol v0.3.0)

View Source

A modal component for displaying overlay dialogs like alerts, prompts, confirmations, and forms.

Summary

Functions

alert(id, title, content, opts \\ [])

Creates props for an alert modal.

broadcast(msg)

command(cmd)

confirm(id, title, content, on_confirm \\ :confirm, on_cancel \\ :cancel, opts \\ [])

Creates props for a confirmation modal.

form(id, title, fields, on_submit \\ :submit, on_cancel \\ :cancel, opts \\ [])

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)

mount(state)

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

prompt(id, title, content, on_submit \\ :submit, on_cancel \\ :cancel, opts \\ [])

Creates props for a prompt modal.

schedule(msg, delay)

unmount(state)

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