Class: UI::SelectScrollDownButtonComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
SelectScrollDownButtonBehavior
Defined in:
app/view_components/ui/select_scroll_down_button_component.rb

Overview

ScrollDownButtonComponent - ViewComponent implementation

Button that appears when content is scrollable downward. Automatically hidden when at bottom of list.

Examples:

Default usage (no customization needed)

<%= render UI::ScrollDownButtonComponent.new %>

Instance Method Summary collapse

Methods included from SelectScrollDownButtonBehavior

#select_scroll_down_button_classes, #select_scroll_down_button_data_attributes, #select_scroll_down_button_html_attributes

Constructor Details

#initialize(classes: "", **attributes) ⇒ SelectScrollDownButtonComponent

Returns a new instance of SelectScrollDownButtonComponent.

Parameters:

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

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



15
16
17
18
# File 'app/view_components/ui/select_scroll_down_button_component.rb', line 15

def initialize(classes: "", **attributes)
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#callObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/view_components/ui/select_scroll_down_button_component.rb', line 20

def call
   :div, **select_scroll_down_button_html_attributes.deep_merge(@attributes) do
     :svg, nil,
      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
         :path, nil, d: "m6 9 6 6 6-6"
      end
  end
end