Class: UI::HoverCardContent

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

Overview

Content - Phlex implementation

The content that appears on hover. Uses HoverCardContentBehavior for shared styling logic.

Examples:

Basic usage

render UI::Content.new { "Hover card content here" }

With custom alignment

render UI::Content.new(align: "start", side_offset: 8) do
  plain "Content"
end

Instance Method Summary collapse

Methods included from HoverCardContentBehavior

#content_classes, #content_data_attributes, #content_html_attributes

Constructor Details

#initialize(align: "center", side_offset: 4, classes: "", **attributes) ⇒ HoverCardContent

Returns a new instance of HoverCardContent.

Parameters:

  • align (String) (defaults to: "center")

    Alignment of the content (“start”, “center”, “end”)

  • side_offset (Integer) (defaults to: 4)

    Distance in pixels from the trigger

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

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



22
23
24
25
26
27
# File 'app/components/ui/hover_card_content.rb', line 22

def initialize(align: "center", side_offset: 4, classes: "", **attributes)
  @align = align
  @side_offset = side_offset
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#view_template(&block) ⇒ Object



29
30
31
# File 'app/components/ui/hover_card_content.rb', line 29

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