Class: Shadcn::CarouselComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::CarouselComponent
- Defined in:
- app/components/shadcn/carousel_component.rb
Overview
Carousel component for sliding content Matches shadcn/ui Carousel component Uses Stimulus for interactivity with swipe and keyboard navigation
Constant Summary collapse
- ORIENTATIONS =
{ horizontal: "horizontal", vertical: "vertical" }.freeze
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(orientation: :horizontal, loop: false, autoplay: false, autoplay_interval: 4000, align: :start, **options) ⇒ CarouselComponent
constructor
A new instance of CarouselComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(orientation: :horizontal, loop: false, autoplay: false, autoplay_interval: 4000, align: :start, **options) ⇒ CarouselComponent
Returns a new instance of CarouselComponent.
53 54 55 56 57 58 59 60 |
# File 'app/components/shadcn/carousel_component.rb', line 53 def initialize(orientation: :horizontal, loop: false, autoplay: false, autoplay_interval: 4000, align: :start, **) super(**) @orientation = orientation.to_sym @loop = loop @autoplay = autoplay @autoplay_interval = autoplay_interval @align = align.to_sym end |
Instance Method Details
#call ⇒ Object
62 63 64 |
# File 'app/components/shadcn/carousel_component.rb', line 62 def call content_tag(:div, carousel_content, carousel_attributes) end |