Class: UI::PopoverContent

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

Overview

Content - Phlex implementation

The floating content panel. Uses PopoverContentBehavior concern for shared styling logic.

Examples:

Basic usage

render UI::Content.new do
  plain "Popover content here"
end

Instance Method Summary collapse

Methods included from PopoverContentBehavior

#popover_content_classes, #popover_content_data_attributes, #popover_content_html_attributes

Constructor Details

#initialize(side: "bottom", align: "center", classes: "", **attributes) ⇒ PopoverContent

Returns a new instance of PopoverContent.

Parameters:

  • side (String) (defaults to: "bottom")

    Side of the trigger to show the content (“top”, “bottom”, “left”, “right”)

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

    Alignment relative to the trigger (“start”, “center”, “end”)

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

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



19
20
21
22
23
24
# File 'app/components/ui/popover_content.rb', line 19

def initialize(side: "bottom", align: "center", classes: "", **attributes)
  @side = side
  @align = align
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#view_template(&block) ⇒ Object



26
27
28
# File 'app/components/ui/popover_content.rb', line 26

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