Class: Fluxbit::TabComponent
- Includes:
- Config::TabComponent
- Defined in:
- app/components/fluxbit/tab_component.rb
Constant Summary
Constants inherited from Component
Instance Attribute Summary collapse
-
#lazy_load ⇒ Object
readonly
Returns the value of attribute lazy_load.
-
#variant ⇒ Object
readonly
Returns the value of attribute variant.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(**props) ⇒ TabComponent
constructor
A new instance of TabComponent.
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) ⇒ TabComponent
16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/components/fluxbit/tab_component.rb', line 16 def initialize(**props) @variant = (props.delete(:variant) || @@variant).to_sym @color = props.delete(:color) || @@color @vertical = props.delete(:vertical) || @@vertical @tab_panel = (props.delete(:tab_panel) || @@tab_panel).to_sym @tabs_group = [] @ul_props = props.delete(:ul_props) || {} @props = props @vertical = false if @variant == :full_width super end |
Instance Attribute Details
#lazy_load ⇒ Object (readonly)
Returns the value of attribute lazy_load.
6 7 8 |
# File 'app/components/fluxbit/tab_component.rb', line 6 def lazy_load @lazy_load end |
#variant ⇒ Object (readonly)
Returns the value of attribute variant.
6 7 8 |
# File 'app/components/fluxbit/tab_component.rb', line 6 def variant @variant end |
Instance Method Details
#call ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/components/fluxbit/tab_component.rb', line 28 def call tabs @has_panels = @tabs_group.map(&:content).compact.present? add class: styles[:div][@vertical ? :vertical : :horizontal], to: @props, first_element: true if @has_panels content_tag :div, **@props do concat(render_tab_list) concat(render_tab_panels) end else concat(render_tab_list) end end |