Class: FoxTail::TabsComponent
Instance Attribute Summary
#html_attributes
Instance Method Summary
collapse
classname_merger, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class
Methods inherited from Base
fox_tail_config
Constructor Details
#initialize(html_attributes = {}) ⇒ TabsComponent
Returns a new instance of TabsComponent.
20
21
22
23
24
|
# File 'app/components/fox_tail/tabs_component.rb', line 20
def initialize(html_attributes = {})
super
self.html_attributes[:id] ||= "tabs-#{SecureRandom.hex(4)}" if controlled?
end
|
Instance Method Details
#before_render ⇒ Object
34
35
36
37
38
39
|
# File 'app/components/fox_tail/tabs_component.rb', line 34
def before_render
super
html_attributes[:role] = :tablist
html_attributes[:class] = classnames theme.apply(:root, self), html_class
end
|
#call ⇒ Object
41
42
43
44
45
46
|
# File 'app/components/fox_tail/tabs_component.rb', line 41
def call
capture do
concat render_tabs
concat render_panels if panels?
end
end
|
#render? ⇒ Boolean
30
31
32
|
# File 'app/components/fox_tail/tabs_component.rb', line 30
def render?
tabs?
end
|
#tag_id ⇒ Object
26
27
28
|
# File 'app/components/fox_tail/tabs_component.rb', line 26
def tag_id
html_attributes[:id]
end
|