Class: PhlexKit::TooltipContent
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::TooltipContent
- Defined in:
- app/components/phlex_kit/tooltip/tooltip_content.rb
Overview
The tooltip bubble. side: picks the edge it opens from (:top default,
:bottom/:left/:right — shadcn's side prop). See tooltip.rb.
Constant Summary collapse
- SIDES =
{ top: nil, bottom: "bottom", left: "left", right: "right" }.freeze
Instance Method Summary collapse
-
#initialize(side: :top, **attrs) ⇒ TooltipContent
constructor
A new instance of TooltipContent.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(side: :top, **attrs) ⇒ TooltipContent
Returns a new instance of TooltipContent.
7 8 9 10 |
# File 'app/components/phlex_kit/tooltip/tooltip_content.rb', line 7 def initialize(side: :top, **attrs) @side = side.to_sym @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
12 13 14 15 |
# File 'app/components/phlex_kit/tooltip/tooltip_content.rb', line 12 def view_template(&) classes = [ "pk-tooltip-content", fetch_option(SIDES, @side, :side) ].compact.join(" ") div(**mix({ class: classes, role: "tooltip" }, @attrs), &) end |