Class: UI::SelectScrollUpButton
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::SelectScrollUpButton
- Defined in:
- app/components/ui/select_scroll_up_button.rb
Overview
Select Scroll Up Button - Phlex implementation
Button that appears when content is scrollable upward. Automatically hidden when at top of list.
Instance Method Summary collapse
-
#initialize(as_child: false, classes: "", **attributes) ⇒ SelectScrollUpButton
constructor
A new instance of SelectScrollUpButton.
- #view_template(&block) ⇒ Object
Methods included from SharedAsChildBehavior
Methods included from SelectScrollUpButtonBehavior
#select_scroll_up_button_classes, #select_scroll_up_button_data_attributes, #select_scroll_up_button_html_attributes
Constructor Details
#initialize(as_child: false, classes: "", **attributes) ⇒ SelectScrollUpButton
Returns a new instance of SelectScrollUpButton.
17 18 19 20 21 |
# File 'app/components/ui/select_scroll_up_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_up_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 up 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: "m18 15-6-6-6 6") end end end end |