Class: Fluxbit::CarouselComponent
- Includes:
- Fluxbit::Config::CarouselComponent
- Defined in:
- app/components/fluxbit/carousel_component.rb
Overview
The ‘Fluxbit::CarouselComponent` is a customizable carousel component that extends `Fluxbit::Component`. It allows you to create image carousels or content sliders with various features like automatic sliding, indicators, navigation controls, and customizable animations.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(**props) ⇒ Fluxbit::CarouselComponent
constructor
Initializes the carousel component with the given properties.
Methods inherited from Component
#add, #add_popover_or_tooltip, #anyicon, #element_name, #fx_id, #icon, #options, #popover?, #random_id, #remove_class, #remove_class_from_props, #render_popover_or_tooltip, #target, #tooltip?
Methods included from IconHelpers
#chevron_double_left, #chevron_double_right, #chevron_down, #chevron_left, #chevron_right, #chevron_up, #close_icon, #ellipsis_horizontal, #eye_icon, #eye_slash_icon, #plus_icon
Constructor Details
#initialize(**props) ⇒ Fluxbit::CarouselComponent
Initializes the carousel component with the given properties.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/components/fluxbit/carousel_component.rb', line 41 def initialize(**props) super @props = props = [] = (@props.delete(:slide), default: ) = (@props.delete(:slide_interval), default: ) @indicators = (@props.delete(:indicators), default: @@indicators) @controls = (@props.delete(:controls), default: @@controls) @left_control = @props.delete(:left_control) @right_control = @props.delete(:right_control) declare_classes # Handle class removal @props[:class] = remove_class(@props.delete(:remove_class) || "", @props[:class]) # Flowbite carousel data attributes @props[:data] ||= {} @props[:data][:carousel] = ? "slide" : "static" end |
Instance Method Details
#call ⇒ Object
63 64 65 66 67 68 69 70 71 |
# File 'app/components/fluxbit/carousel_component.rb', line 63 def call # Ensure slides are rendered tag.div(**@props) do concat() concat(render_indicators) if @indicators concat(render_controls) if @controls end end |