Module: BetterUi::General::Components::Heading::HeadingHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/better_ui/general/components/heading/heading_helper.rb

Instance Method Summary collapse

Instance Method Details

#bui_heading(text, level: 2, theme: :white, align: :left, size: :medium, style: :normal, icon: nil, subtitle: nil, with_divider: false, **html_options) ⇒ String

Genera un heading usando BetterUi::General::Heading::Component

Examples:

Uso base

bui_heading("Titolo principale")
bui_heading("Sottotitolo", level: 3, theme: :blue)

Con icona e sottotitolo

bui_heading("Dashboard", icon: "home", subtitle: "Panoramica generale")

Con divider

bui_heading("Sezione", level: 2, with_divider: true, theme: :green)

Con opzioni avanzate

bui_heading(
  "Titolo personalizzato",
  level: 1,
  theme: :violet,
  align: :center,
  size: :large,
  style: :bold,
  icon: "star",
  subtitle: "Con tutte le opzioni",
  with_divider: true,
  id: "main-title",
  class: "custom-heading"
)

Parameters:

  • text (String)

    testo del heading

  • level (Integer) (defaults to: 2)

    livello del heading (1-6)

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

    tema del colore (:default, :white, etc.)

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

    allineamento (:left, :center, :right)

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

    dimensione (:small, :medium, :large)

  • style (Symbol) (defaults to: :normal)

    stile (:normal, :bold, :italic, :underline)

  • icon (String) (defaults to: nil)

    icona opzionale

  • subtitle (String) (defaults to: nil)

    sottotitolo opzionale

  • with_divider (Boolean) (defaults to: false)

    mostra linea divisoria

  • html_options (Hash)

    opzioni HTML per il container

Returns:

  • (String)

    HTML del heading renderizzato



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'app/helpers/better_ui/general/components/heading/heading_helper.rb', line 44

def bui_heading(
  text,
  level: 2,
  theme: :white,
  align: :left,
  size: :medium,
  style: :normal,
  icon: nil,
  subtitle: nil,
  with_divider: false,
  **html_options
)
  render BetterUi::General::Heading::Component.new(
    level: level,
    theme: theme,
    align: align,
    size: size,
    style: style,
    icon: icon,
    subtitle: subtitle,
    with_divider: with_divider,
    **html_options
  ).with_content(text)
end