# `PhoenixDuskmoon.Component.Feedback.Dialog`
[🔗](https://github.com/duskmoon-dev/phoenix-duskmoon-ui.git/blob/v10.1.4/lib/phoenix_duskmoon/component/feedback/dialog.ex#L1)

Modal dialog component using the native HTML `<dialog>` element and
`@duskmoon-dev/core` dialog CSS.

Open and close with the Invoker Commands API (`command` / `commandfor`).
The client-owned `open` attribute is preserved across LiveView patches.

## Examples

    <.dm_modal id="my-modal">
      <:trigger :let={id}>
        <.dm_btn variant="primary" command="show-modal" commandfor={id}>Open</.dm_btn>
      </:trigger>
      <:title>PhoenixDuskmoon</:title>
      <:body>Modal content here</:body>
      <:footer>
        <.dm_btn command="close" commandfor="my-modal">Close</.dm_btn>
      </:footer>
    </.dm_modal>

# `dm_modal`

Renders a modal dialog.

## Examples

    <.dm_modal id="my-modal">
      <:trigger :let={id}>
        <button type="button" command="show-modal" commandfor={id}>Open</button>
      </:trigger>
      <:title>Modal Title</:title>
      <:body>Modal body content</:body>
    </.dm_modal>

## Attributes

* `id` (`:any`) - Modal id.
* `class` (`:any`) - Additional CSS classes. Defaults to `nil`.
* `hide_close` (`:boolean`) - Hide the close button. Defaults to `false`.
* `position` (`:string`) - Modal position (top / bottom; middle is default centered). Defaults to `nil`. Must be one of `nil`, `"top"`, `"middle"`, or `"bottom"`.
* `size` (`:string`) - Modal size (sm / lg / xl map to core classes; xs and md use default width). Defaults to `nil`. Must be one of `nil`, `"xs"`, `"sm"`, `"md"`, `"lg"`, or `"xl"`.
* `close_label` (`:string`) - Accessible label for the close button. Defaults to `"Close"`.
* `dialog_label` (`:string`) - Accessible fallback label when no title slot is provided (i18n). Defaults to `"Dialog"`.
* `phx-mounted` (`Phoenix.LiveView.JS`) - additional LiveView JS commands composed before preserving the open attribute. Defaults to `%Phoenix.LiveView.JS{ops: []}`.
* Global attributes are accepted.
## Slots

* `trigger` - Element that opens the modal. Accepts attributes:

  * `class` (`:any`) - trigger wrapper CSS classes.
* `title` - Modal title. Accepts attributes:

  * `class` (`:any`) - title container CSS classes.
* `body` (required) - Modal content. Accepts attributes:

  * `class` (`:any`) - body container CSS classes.
* `footer` - Modal footer with actions. Accepts attributes:

  * `class` (`:any`) - footer container CSS classes.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
