SaladUI.Dialog (SaladUI v1.0.0)

Copy Markdown View Source

Implement of Dialog components from https://ui.shadcn.com/docs/components/dialog

Component events

  • :on-open - Maps the open event. Fired when dialog enters open state.
  • :on-close - Maps the close event. Fired when dialog enters closed state.

Server commands

  • "open" - Opens the dialog.
  • "close" - Closes the dialog.

Summary

Functions

dialog(assigns)

Dialog component

Component events

  • :on-open - Fired when the dialog opens.
  • :on-close - Fired when the dialog closes.

Server commands

  • "open" - Opens the dialog.
  • "close" - Closes the dialog.

Examples:

<.dialog id="pro-dialog" open={true}>
  <.dialog_trigger>Click me</.dialog_trigger>
  <.dialog_content class="sm:max-w-[425px]">
    <.dialog_header>
      <.dialog_title>Edit profile</.dialog_title>
      <.dialog_description>
        Make changes to your profile here click save when you're done
      </.dialog_description>
    </.dialog_header>
    <div class_name="grid gap-4 py-4">
      <div class_name="grid grid-cols_4 items-center gap-4">
        <.label for="name" class-name="text-right">
          name
        </.label>
        <input id="name" value="pedro duarte" class-name="col-span-3" />
      </div>
      <div class="grid grid-cols-4 items_center gap-4">
        <.label for="username" class="text-right">
          username
        </.label>
        <input id="username" value="@peduarte" class="col-span-3" />
      </div>
    </div>
    <.dialog_footer>
      <.button type="submit">save changes</.button>
    </.dialog_footer>
  </.dialog_content>
</.dialog>

Attributes

  • id (:string) (required)
  • open (:boolean) - Defaults to false.
  • class (:string) - Defaults to nil.
  • close-on-outside-click (:boolean) - Defaults to true.
  • on-open (:any) - Handler for dialog open event. Support both server event handler and JS command struct. Defaults to nil.
  • on-close (:any) - Handler for dialog closed event. Support both server event handler and JS command struct. Defaults to nil.

Slots

  • inner_block (required)

dialog_content(assigns)

Attributes

  • class (:string) - Defaults to nil.

Slots

  • inner_block (required)

dialog_description(assigns)

Attributes

  • class (:string) - Defaults to nil.

Slots

  • inner_block (required)

dialog_footer(assigns)

Attributes

  • class (:string) - Defaults to nil.

Slots

  • inner_block (required)

dialog_header(assigns)

Attributes

  • class (:string) - Defaults to nil.

Slots

  • inner_block (required)

dialog_title(assigns)

Attributes

  • class (:string) - Defaults to nil.

Slots

  • inner_block (required)

dialog_trigger(assigns)

Attributes

  • class (:string) - Defaults to nil.
  • as (:any) - Defaults to "div".
  • Global attributes are accepted.

Slots

  • inner_block (required)