Class: UI::SelectScrollDownButton
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::SelectScrollDownButton
- Defined in:
- app/components/ui/select_scroll_down_button.rb
Overview
Select Scroll Down Button - Phlex implementation
Button that appears when content is scrollable downward. Automatically hidden when at bottom of list.
Instance Method Summary collapse
-
#initialize(as_child: false, classes: "", **attributes) ⇒ SelectScrollDownButton
constructor
A new instance of SelectScrollDownButton.
- #view_template(&block) ⇒ Object
Methods included from SharedAsChildBehavior
Methods included from SelectScrollDownButtonBehavior
#select_scroll_down_button_classes, #select_scroll_down_button_data_attributes, #select_scroll_down_button_html_attributes
Constructor Details
#initialize(as_child: false, classes: "", **attributes) ⇒ SelectScrollDownButton
Returns a new instance of SelectScrollDownButton.
17 18 19 20 21 |
# File 'app/components/ui/select_scroll_down_button.rb', line 17 def initialize(as_child: false, classes: "", **attributes) @as_child = as_child @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 43 44 45 46 |
# File 'app/components/ui/select_scroll_down_button.rb', line 23 def view_template(&block) = .deep_merge(@attributes) if @as_child && block_given? # asChild mode: yield attributes to block yield() else # Default mode: render as div with chevron down icon div(**) do svg( class: "size-4", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", stroke_width: "2", stroke_linecap: "round", stroke_linejoin: "round" ) do |s| s.path(d: "m6 9 6 6 6-6") end end end end |