Class: UI::HoverCard

Inherits:
Phlex::HTML
  • Object
show all
Includes:
HoverCardBehavior
Defined in:
app/components/ui/hover_card.rb

Overview

HoverCard - Phlex implementation

Container for hover card trigger and content. Uses HoverCardBehavior for shared styling logic.

Examples:

Basic usage

render UI::HoverCard.new do
  render UI::Trigger.new { "Hover me" }
  render UI::Content.new { "Hover card content" }
end

Instance Method Summary collapse

Methods included from HoverCardBehavior

#hover_card_classes, #hover_card_data_attributes, #hover_card_html_attributes

Constructor Details

#initialize(classes: "", **attributes) ⇒ HoverCard

Returns a new instance of HoverCard.

Parameters:

  • classes (String) (defaults to: "")

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



18
19
20
21
# File 'app/components/ui/hover_card.rb', line 18

def initialize(classes: "", **attributes)
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#view_template(&block) ⇒ Object



23
24
25
# File 'app/components/ui/hover_card.rb', line 23

def view_template(&block)
  div(**hover_card_html_attributes, &block)
end