DaisyUIComponents.Modal (DaisyUIComponents v0.9.3)
View SourceModal component
Summary
Functions
Returns the updated JavaScript state with the modal closed.
Renders a dialog modal.
Returns the JS object with the modal displayed and focused.
Functions
Returns the updated JavaScript state with the modal closed.
Parameters
- js - an optional composable JS script to be executed.
- id - The id of the modal to be hidden.
Description
Removes the "open" attribute from the specified modal and sets the focus away from it.
Renders a dialog modal.
Examples
<.modal id="confirm-modal">
This is a modal
</.modal>JS commands may be passed to the :on_cancel to configure
the closing/cancel event, for example:
<.modal id="confirm" on_cancel={JS.navigate(~p"/posts")}>
This is another modal
</.modal>dialog with slots and actions:
<.modal id="confirm">
<:modal_box class="w-11/12 max-w-5xl">
Modal to confirm
<.modal_action>
<.button>Confirm</.button>
</.modal_action>
</:modal_box>
</.modal>Attributes
id(:string) (required)class(:string) - Defaults tonil.open(:boolean) - Defaults tofalse.show(:boolean) - Behaves likeopenattribute. This attribute exist to avoid compatibility issues with phoenix core components. Defaults tonil.closeable(:boolean) - Defaults totrue.close_on_click_away(:boolean) - Defaults tofalse.on_cancel(Phoenix.LiveView.JS) - Defaults to%Phoenix.LiveView.JS{ops: []}.- Global attributes are accepted.
Slots
modal_box- the slot for compacting the modal body. Accepts attributes:class(:string)content_class(:string)
inner_block
Attributes
class(:string) - Defaults tonil.
Slots
inner_block
Attributes
modal_id(:string) (required)class(:string) - Defaults tonil.content_class(:string) - Defaults tonil.closeable(:boolean) - Defaults totrue.close_on_click_away(:boolean) - Defaults tofalse.- Global attributes are accepted.
Slots
inner_blockactions- the slot for showing modal actions.
Returns the JS object with the modal displayed and focused.
Parameters
- js - an optional composable JS script to be executed.
- id - The id of the modal to be shown.
Description
Updates the specified modal's state to open and focuses on its first content element.