PhoenixDuskmoon.Component.Action.Button (PhoenixDuskmoon v9.0.1)
View SourceButton 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
@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 tonil.class(:any) - Additional CSS classes. Defaults tonil.variant(:string) - Button color variant. Defaults tonil. Must be one ofnil,"primary","secondary","accent","info","success","warning","error","ghost","link", or"outline".size(:string) - Button size. Defaults tonil. Must be one ofnil,"xs","sm","md", or"lg".shape(:string) - Button shape. Defaults tonil. Must be one ofnil,"square", or"circle".loading(:boolean) - Show loading state. Defaults tofalse.disabled(:boolean) - Disable the button. Defaults tofalse.noise(:boolean) - Use noise effect button style. Defaults tofalse.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 tonil.cancel_class(:any) - CSS class for cancel button. Defaults tonil.show_cancel_action(:boolean) - Show cancel button in dialog. Defaults totrue.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.