Class: UI::SelectContentComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::SelectContentComponent
- Includes:
- SelectContentBehavior
- Defined in:
- app/view_components/ui/select_content_component.rb
Overview
ContentComponent - ViewComponent implementation
Dropdown container that holds items and groups. Includes scroll buttons and viewport.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(classes: "", **attributes) ⇒ SelectContentComponent
constructor
A new instance of SelectContentComponent.
Methods included from SelectContentBehavior
#select_content_classes, #select_content_html_attributes
Constructor Details
#initialize(classes: "", **attributes) ⇒ SelectContentComponent
Returns a new instance of SelectContentComponent.
18 19 20 21 |
# File 'app/view_components/ui/select_content_component.rb', line 18 def initialize(classes: "", **attributes) @classes = classes @attributes = attributes end |
Instance Method Details
#call ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/view_components/ui/select_content_component.rb', line 23 def call content_tag :div, **select_content_html_attributes.deep_merge(@attributes) do safe_join([ render(UI::SelectScrollUpButtonComponent.new), content_tag(:div, content, data: { radix_select_viewport: true, ui__select_target: "viewport", 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;"), render(UI::SelectScrollDownButtonComponent.new) ]) end end |