Class: PhlexKit::Tooltip

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/tooltip/tooltip.rb

Overview

Hover/focus tooltip. ruby_ui's version uses @floating-ui + a cloned template; we keep the Trigger/Content structure but reveal + position the bubble with pure CSS (no JS, no npm dep) — same call as the Select floating-ui strip. The tiny phlex-kit--tooltip controller only wires aria-describedby and Escape-dismiss (WCAG 1.4.13); reveal stays CSS. Bubble sits above the trigger. Compose TooltipTrigger + TooltipContent.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ Tooltip

Returns a new instance of Tooltip.



9
10
11
# File 'app/components/phlex_kit/tooltip/tooltip.rb', line 9

def initialize(**attrs)
  @attrs = attrs
end

Instance Method Details

#view_template(&block) ⇒ Object



13
14
15
# File 'app/components/phlex_kit/tooltip/tooltip.rb', line 13

def view_template(&block)
  div(**mix({ class: "pk-tooltip", data: { controller: "phlex-kit--tooltip" } }, @attrs), &block)
end