ShadcnUI.Components.Foundation.Button (shadcn_ui v1.0.0)

Copy Markdown View Source

Native button actions with closed shadcn-style variants and sizes.

Button renders one native button. The caller owns activation, submission, duplicate prevention, authorization, request lifecycle, and command outcomes. loading changes only the rendered busy presentation and never disables the button automatically.

Summary

Functions

Renders a native button.

Functions

button(assigns)

Renders a native button.

Leading and trailing slots are trusted HEEX regions. Callers should mark a purely decorative icon aria-hidden="true". Icon-sized buttons require an explicit nonblank accessible_label.

Attributes

  • type (:string) - Defaults to "button". Must be one of "button", "submit", or "reset".
  • variant (:atom) - Defaults to :default. Must be one of :default, :secondary, :destructive, :outline, :ghost, or :link.
  • size (:atom) - Defaults to :default. Must be one of :small, :default, :large, or :icon.
  • disabled (:boolean) - Defaults to false.
  • loading (:boolean) - Defaults to false.
  • accessible_label (:string) - Accessible name override; required and nonblank for icon-only buttons. Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["autofocus", "form", "name", "value"].

Slots

  • leading
  • inner_block (required)
  • trailing