PhoenixDuskmoon.Component.Action.Button (PhoenixDuskmoon v9.0.1)

View Source

Button component using el-dm-button custom element.

Provides three button modes:

  • Standard button with variants and sizes
  • Button with confirmation dialog
  • Noise effect button (decorative)

Examples

<.dm_btn>Click me</.dm_btn>

<.dm_btn variant="primary" size="lg">Primary</.dm_btn>

<.dm_btn variant="error" confirm="Are you sure?">Delete</.dm_btn>

<.dm_btn noise content="SUBMIT">Submit</.dm_btn>

Summary

Functions

Generates a button.

Functions

dm_btn(assigns)

@spec dm_btn(map()) :: Phoenix.LiveView.Rendered.t()

Generates a button.

Examples

<.dm_btn id="show-btn">Show</.dm_btn>

<.dm_btn variant="primary" size="lg">Primary Button</.dm_btn>

<.dm_btn confirm="Are you sure?" confirm_title="Confirm Action">Delete</.dm_btn>

Attributes

  • id (:any) - HTML id attribute. Defaults to nil.
  • class (:any) - Additional CSS classes. Defaults to nil.
  • variant (:string) - Button color variant. Defaults to nil. Must be one of nil, "primary", "secondary", "accent", "info", "success", "warning", "error", "ghost", "link", or "outline".
  • size (:string) - Button size. Defaults to nil. Must be one of nil, "xs", "sm", "md", or "lg".
  • shape (:string) - Button shape. Defaults to nil. Must be one of nil, "square", or "circle".
  • loading (:boolean) - Show loading state. Defaults to false.
  • disabled (:boolean) - Disable the button. Defaults to false.
  • noise (:boolean) - Use noise effect button style. Defaults to false.
  • content (:string) - Content text for noise button. Defaults to "".
  • confirm (:string) - Confirmation message (enables confirm dialog). Defaults to "".
  • confirm_title (:string) - Title for confirmation dialog. Defaults to "".
  • confirm_text (:string) - Text for the confirm button in dialog. Defaults to "Yes".
  • cancel_text (:string) - Text for the cancel button in dialog. Defaults to "Cancel".
  • confirm_class (:any) - CSS class for confirm button. Defaults to nil.
  • cancel_class (:any) - CSS class for cancel button. Defaults to nil.
  • show_cancel_action (:boolean) - Show cancel button in dialog. Defaults to true.
  • confirm_dialog_label (:string) - Accessible fallback label for confirm dialog when no title is set (i18n). Defaults to "Confirmation".
  • Global attributes are accepted. Additional HTML attributes. Supports all globals plus: ["phx-click", "phx-target", "phx-value-id", "phx-disable-with", "name", "value", "type", "form"].

Slots

  • inner_block (required) - Button content.
  • prefix - Content before button text (e.g., icon).
  • suffix - Content after button text (e.g., icon).
  • confirm_action - Custom confirm action button content.