Class: UI::ScrollAreaThumbComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::ScrollAreaThumbComponent
- Includes:
- ScrollAreaThumbBehavior
- Defined in:
- app/view_components/ui/scroll_area_thumb_component.rb
Overview
ThumbComponent - ViewComponent implementation
Draggable scroll indicator inside the scrollbar.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(classes: "", **attributes) ⇒ ScrollAreaThumbComponent
constructor
A new instance of ScrollAreaThumbComponent.
Methods included from ScrollAreaThumbBehavior
#scroll_area_thumb_classes, #scroll_area_thumb_html_attributes
Constructor Details
#initialize(classes: "", **attributes) ⇒ ScrollAreaThumbComponent
Returns a new instance of ScrollAreaThumbComponent.
14 15 16 17 |
# File 'app/view_components/ui/scroll_area_thumb_component.rb', line 14 def initialize(classes: "", **attributes) @classes = classes @attributes = attributes end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/view_components/ui/scroll_area_thumb_component.rb', line 19 def call thumb_attrs = scroll_area_thumb_html_attributes.deep_merge(@attributes) # Add Stimulus target and action for drag thumb_attrs[:data] ||= {} thumb_attrs[:data][:"ui--scroll-area-target"] = "thumb" thumb_attrs[:data][:action] = "pointerdown->ui--scroll-area#startDrag" content_tag :div, nil, **thumb_attrs end |