FrappeUIPhx.Components.Button (frappe_ui_phx v0.3.1)

Copy Markdown View Source

Botão do Frappe UI: variantes solid | subtle | outline | ghost, temas gray | blue | green | red, tamanhos xs | sm | md | lg.

Vira <.link> quando recebe href, navigate ou patch (e não está inerte); caso contrário é um <button>. Com loading, mostra o spinner e fica inerte, mas mantém o visual normal (igual ao original).

Summary

Functions

Classes do botão para a combinação de atributos. Função pura, testável sem renderizar.

Functions

button(assigns)

Attributes

  • theme (:atom) - Defaults to :gray. Must be one of :gray, :blue, :green, or :red.
  • variant (:atom) - Defaults to :subtle. Must be one of :solid, :subtle, :outline, or :ghost.
  • size (:atom) - Defaults to :sm. Must be one of :xs, :sm, :md, or :lg.
  • label (:string) - Defaults to nil.
  • icon (:string) - botão só com ícone (nome Lucide). Defaults to nil.
  • icon_left (:string) - Defaults to nil.
  • icon_right (:string) - Defaults to nil.
  • loading (:boolean) - Defaults to false.
  • loading_text (:string) - Defaults to nil.
  • disabled (:boolean) - Defaults to false.
  • type (:string) - Defaults to "button".
  • class (:any) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["href", "navigate", "patch", "method", "download", "name", "value", "form"].

Slots

  • inner_block

classes(attrs)

@spec classes(map()) :: [String.t() | nil]

Classes do botão para a combinação de atributos. Função pura, testável sem renderizar.