Class: Shadcn::Carousel::Item::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Carousel::Item::Component
- Defined in:
- app/components/shadcn/carousel/item/component.rb
Overview
CarouselItem — one slide, full width until the caller says otherwise
with a basis-* of its own, which is upstream's "Sizes" example.
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#orientation ⇒ Object
readonly
Returns the value of attribute orientation.
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #element_attributes(**defaults) ⇒ Object
-
#initialize(orientation: :horizontal, **attributes) ⇒ Component
constructor
A new instance of Component.
- #style_variants ⇒ Object
Methods inherited from ApplicationViewComponent
#call, #css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #tag_name
Constructor Details
#initialize(orientation: :horizontal, **attributes) ⇒ Component
Returns a new instance of Component.
26 27 28 29 |
# File 'app/components/shadcn/carousel/item/component.rb', line 26 def initialize(orientation: :horizontal, **attributes) @orientation = orientation&.to_sym == :vertical ? :vertical : :horizontal super(**attributes) end |
Instance Attribute Details
#orientation ⇒ Object (readonly)
Returns the value of attribute orientation.
24 25 26 |
# File 'app/components/shadcn/carousel/item/component.rb', line 24 def orientation @orientation end |
Instance Method Details
#element_attributes(**defaults) ⇒ Object
33 34 35 36 37 38 |
# File 'app/components/shadcn/carousel/item/component.rb', line 33 def element_attributes(**defaults) super(**{ role: "group", "aria-roledescription" => "slide" }.merge(defaults)) end |
#style_variants ⇒ Object
31 |
# File 'app/components/shadcn/carousel/item/component.rb', line 31 def style_variants = { orientation: } |