Class: PopupComponent

Inherits:
Component show all
Includes:
Positionable
Defined in:
app/components/popup_component.rb

Overview

Popup — tooltips and popup content.

Usage:

Popup(content: "Tooltip text", position: "top center") {
  Button { text "Hover me" }
}
Popup(hoverable: true) { text "Hover for popup" }

Constant Summary

Constants inherited from Component

Component::HTML_OPTIONS

Instance Method Summary collapse

Methods inherited from Component

default, #initialize, #render_in, slot

Constructor Details

This class inherits a constructor from Component

Instance Method Details

#to_sObject



21
22
23
24
25
26
27
28
29
30
# File 'app/components/popup_component.rb', line 21

def to_s
  data = { controller: "fui-popup", fui_popup_position_value: position }
  data[:fui_popup_content_value] = content if content
  data[:fui_popup_title_value] = title if title
  data[:fui_popup_hoverable_value] = "true" if hoverable
  data[:fui_popup_variation_value] = variation if variation
  data[:fui_popup_on_value] = on if on != "hover"

  tag.span(data: data) { @content }
end