Class: Fluxbit::ButtonGroupComponent
- Includes:
- Config::ButtonComponent
- Defined in:
- app/components/fluxbit/button_group_component.rb
Overview
The ‘Fluxbit::ButtonGroupComponent` is a component for rendering a group of buttons. It extends `Fluxbit::Component` and provides options for configuring the appearance and behavior of the button group. You can control the buttons displayed within the group. The component supports rendering multiple buttons, each of which can be styled or customized through various properties.
Constant Summary
Constants inherited from Component
Instance Attribute Summary collapse
-
#buttons_group ⇒ Object
Returns the value of attribute buttons_group.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(**props) ⇒ ButtonGroupComponent
constructor
Initializes the button group component with the given properties.
Methods inherited from Component
#add, #add_popover_or_tooltip, #anyicon, #element_name, #fx_id, #options, #random_id, #remove_class, #render_popover_or_tooltip, #target
Constructor Details
#initialize(**props) ⇒ ButtonGroupComponent
Initializes the button group component with the given properties.
21 22 23 24 25 26 |
# File 'app/components/fluxbit/button_group_component.rb', line 21 def initialize(**props) super @props = props = [] add class: styles[:group], to: @props end |
Instance Attribute Details
#buttons_group ⇒ Object
Returns the value of attribute buttons_group.
9 10 11 |
# File 'app/components/fluxbit/button_group_component.rb', line 9 def end |
Instance Method Details
#call ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/components/fluxbit/button_group_component.rb', line 28 def call content_tag :div, **@props do .each_with_index do |, index| = .props || {} = .content [:grouped] = true [:first_button] = true if index == 0 [:last_button] = true if index == .size - 1 concat Fluxbit::ButtonComponent.new(**).with_content().render_in(view_context) end end end |