Class: Sirens::Tabs

Inherits:
PrimitiveComponent show all
Defined in:
lib/components/containers/tabs.rb

Overview

Component that wraps a TabsView.

Instance Method Summary collapse

Methods inherited from PrimitiveComponent

#apply_props, #initialize, #on_model_changed, #on_value_changed, #populate_popup_menu, #set_props, #subscribe_to_model_events, #sync_ui_from_model

Methods inherited from AbstractComponent

#add_all_components, #add_component, #child_components, #default_model, #initialize, #model, #on_model_changed, open, #props, #remove_component_at, #remove_last_component, #set_model, #set_props, #view

Constructor Details

This class inherits a constructor from Sirens::PrimitiveComponent

Instance Method Details

#create_viewObject

Returns a StackView.



9
10
11
# File 'lib/components/containers/tabs.rb', line 9

def create_view()
    TabsView.new
end

#on_component_added(child_component) ⇒ Object

Adds the child_component to this component.



16
17
18
19
20
21
22
# File 'lib/components/containers/tabs.rb', line 16

def on_component_added(child_component)
    super(child_component)

    tab_label_text = child_component.props[:tab_label]

    view.set_tab_label_at(index: @child_components.size - 1, text: tab_label_text)
end