Class: DesignSystem::Components::Tab
- Inherits:
-
Object
- Object
- DesignSystem::Components::Tab
- Defined in:
- lib/design_system/components/tab.rb
Overview
This class helps to design Tab component
Instance Attribute Summary collapse
-
#tabs ⇒ Object
Returns the value of attribute tabs.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #add_tab_panel(name, content, id = nil, selected: false, &block) ⇒ Object
-
#initialize(view_context = nil) ⇒ Tab
constructor
A new instance of Tab.
Constructor Details
#initialize(view_context = nil) ⇒ Tab
Returns a new instance of Tab.
9 10 11 12 |
# File 'lib/design_system/components/tab.rb', line 9 def initialize(view_context = nil) @view_context = view_context @tabs = [] end |
Instance Attribute Details
#tabs ⇒ Object
Returns the value of attribute tabs.
7 8 9 |
# File 'lib/design_system/components/tab.rb', line 7 def tabs @tabs end |
#title ⇒ Object
Returns the value of attribute title.
7 8 9 |
# File 'lib/design_system/components/tab.rb', line 7 def title @title end |
Instance Method Details
#add_tab_panel(name, content, id = nil, selected: false, &block) ⇒ Object
14 15 16 17 |
# File 'lib/design_system/components/tab.rb', line 14 def add_tab_panel(name, content, id = nil, selected: false, &block) content ||= @view_context.capture(&block) if block_given? @tabs << [name, content, id, selected] end |