Module: BetterUi::General::Components::Tooltip::TooltipHelper

Included in:
BetterUi::General::Components::Tooltip
Defined in:
app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb

Instance Method Summary collapse

Instance Method Details

#bui_tooltip(text, theme: :white, position: :top, size: :medium, style: :filled, **html_options, &block) ⇒ String

Genera un tooltip usando BetterUi::General::Tooltip::Component

Examples:

Uso base

bui_tooltip("Questo è un tooltip") do
  bui_button(label: "Hover me")
end

Tooltip con posizione specifica

bui_tooltip("Messaggio importante", position: :right, theme: :red) do
  link_to "Info", "#", class: "text-blue-500"
end

Tooltip con stili avanzati

bui_tooltip(
  "Tooltip grande con outline",
  theme: :blue,
  position: :bottom,
  size: :large,
  style: :outline,
  id: "custom-tooltip"
) do
  (:span, "Trigger personalizzato", class: "custom-trigger")
end

Parameters:

  • text (String)

    testo del tooltip

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

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

  • position (Symbol) (defaults to: :top)

    posizione del tooltip (:top, :right, :bottom, :left)

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

    dimensione del tooltip (:small, :medium, :large)

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

    stile del tooltip (:filled, :outline)

  • html_options (Hash)

    opzioni HTML aggiuntive

  • block (Block)

    contenuto dell’elemento trigger

Returns:

  • (String)

    HTML del tooltip renderizzato



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb', line 38

def bui_tooltip(
  text,
  theme: :white,
  position: :top,
  size: :medium,
  style: :filled,
  **html_options,
  &block
)
  render BetterUi::General::Tooltip::Component.new(
    text: text,
    theme: theme,
    position: position,
    size: size,
    style: style,
    **html_options
  ), &block
end