Module: BetterUi::General::Components::Button::ButtonHelper

Included in:
Application::Sidebar::Component, ApplicationHelper
Defined in:
app/helpers/better_ui/general/components/button/button_helper.rb

Instance Method Summary collapse

Instance Method Details

#bui_button(text = nil, theme: :white, size: :medium, full_width: false, disabled: false, icon: nil, icon_position: :left, href: nil, method: nil, data: {}, classes: nil, id: nil, rounded: :medium, button_type: :button, **html_options, &block) ⇒ String

Helper per renderizzare un bottone

Parameters:

  • text (String) (defaults to: nil)

    Testo del bottone (argomento posizionale)

  • theme (Symbol) (defaults to: :white)

    Tema del bottone (:default, :white, :red, etc.)

  • size (Symbol) (defaults to: :medium)

    Dimensione del bottone (:small, :medium, :large)

  • full_width (Boolean) (defaults to: false)

    Larghezza completa

  • disabled (Boolean) (defaults to: false)

    Stato disabilitato

  • icon (String) (defaults to: nil)

    Nome icona (opzionale)

  • icon_position (Symbol) (defaults to: :left)

    Posizione icona (:left, :right)

  • href (String) (defaults to: nil)

    URL per il link (opzionale)

  • method (Symbol) (defaults to: nil)

    Metodo HTTP (opzionale)

  • data (Hash) (defaults to: {})

    Attributi data

  • classes (String) (defaults to: nil)

    Classi CSS aggiuntive

  • id (String) (defaults to: nil)

    ID elemento

  • rounded (Symbol) (defaults to: :medium)

    Tipo di border-radius (:none, :small, :medium, :large, :full)

  • html_options (Hash)

    Opzioni HTML aggiuntive

Returns:

  • (String)

    HTML del bottone



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'app/helpers/better_ui/general/components/button/button_helper.rb', line 25

def bui_button(
  text = nil,
  theme: :white,
  size: :medium,
  full_width: false,
  disabled: false,
  icon: nil,
  icon_position: :left,
  href: nil,
  method: nil,
  data: {},
  classes: nil,
  id: nil,
  rounded: :medium,
  button_type: :button,
  **html_options,
  &block
)
  render BetterUi::General::Button::Component.new(
    text: text,
    theme: theme,
    size: size,
    full_width: full_width,
    disabled: disabled,
    icon: icon,
    icon_position: icon_position,
    href: href,
    method: method,
    data: data,
    classes: classes,
    id: id,
    rounded: rounded,
    button_type: button_type,
    **html_options
  ), &block
end