PhoenixDuskmoon.Component.Button (PhoenixDuskmoon v7.2.1)

View Source

Duskmoon UI Button Component

Summary

Functions

Generates a button.

Functions

dm_btn(assigns)

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

Generates a button.

Attributes

  • id (:any)
  • class (:any) - the class of the button. Defaults to nil.
  • variant (:string) - the color variant of the button (primary, secondary, accent, info, success, warning, error, ghost, link, outline). Defaults to nil.
  • size (:string) - the size of the button (xs, sm, md, lg). Defaults to nil.
  • shape (:string) - the shape of the button (square, circle). Defaults to nil.
  • glass (:boolean) - apply glass effect to the button. Defaults to false.
  • loading (:boolean) - show loading state. Defaults to false.
  • disabled (:boolean) - disable the button. Defaults to false.
  • noise (:boolean) - the noise of the button. Defaults to false.
  • content (:string) - the content of noise button. Defaults to "".
  • confirm_class (:any) - the class of the confirm action button in dialog. Defaults to nil.
  • cancel_class (:any) - the class of the cancel action button in dialog. Defaults to nil.
  • show_cancel_action (:boolean) - Defaults to true.
  • confirm_title (:string) - Defaults to "".
  • confirm (:string) - Defaults to "".
  • Global attributes are accepted. Additional attributes to confirm action button.

Slots

  • inner_block (required) - The content rendered inside of the button tag.
  • confirm_action - the action of the confirm action button in dialog.

Examples

<.dm_btn id="show-btn">Show</.dm_btn>
<.dm_btn id="remove-btn" confirm_action={JS.push("remove", value: %{"id" => @id})}>Remove</.dm_btn>