Class: UI::SelectContent
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::SelectContent
- Includes:
- SelectContentBehavior
- Defined in:
- app/components/ui/select_content.rb
Overview
Select Content - Phlex implementation
Dropdown container that holds items and groups. Includes scroll buttons and viewport.
Instance Method Summary collapse
-
#initialize(classes: "", **attributes) ⇒ SelectContent
constructor
A new instance of SelectContent.
- #view_template(&block) ⇒ Object
Methods included from SelectContentBehavior
#select_content_classes, #select_content_html_attributes
Constructor Details
#initialize(classes: "", **attributes) ⇒ SelectContent
Returns a new instance of SelectContent.
18 19 20 21 |
# File 'app/components/ui/select_content.rb', line 18 def initialize(classes: "", **attributes) @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/components/ui/select_content.rb', line 23 def view_template(&block) div(**select_content_html_attributes.deep_merge(@attributes)) do # Scroll up button render UI::SelectScrollUpButton.new # Viewport with scrollable content div( data_radix_select_viewport: true, data_ui__select_target: "viewport", data_action: "scroll->ui--select#handleScroll", class: "size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1 focus-visible:ring-ring/50 p-1", style: "overflow-y: auto; overflow-x: hidden;" ) do yield if block_given? end # Scroll down button render UI::SelectScrollDownButton.new end end |