Class: GovukComponent::Tabs::Tab
- Defined in:
- app/components/govuk_component/tabs.rb
Instance Attribute Summary collapse
-
#title ⇒ Object
Returns the value of attribute title.
Attributes included from GovukComponent::Traits::CustomHtmlAttributes
Instance Method Summary collapse
- #default_classes ⇒ Object
- #hidden_class(i = nil) ⇒ Object
- #id(prefix: nil) ⇒ Object
-
#initialize(title:, classes: [], html_attributes: {}) ⇒ Tab
constructor
A new instance of Tab.
Methods included from GovukComponent::Traits::CustomClasses
Constructor Details
#initialize(title:, classes: [], html_attributes: {}) ⇒ Tab
Returns a new instance of Tab.
24 25 26 27 28 |
# File 'app/components/govuk_component/tabs.rb', line 24 def initialize(title:, classes: [], html_attributes: {}) super(classes: classes, html_attributes: html_attributes) self.title = title end |
Instance Attribute Details
#title ⇒ Object
Returns the value of attribute title.
22 23 24 |
# File 'app/components/govuk_component/tabs.rb', line 22 def title @title end |
Instance Method Details
#default_classes ⇒ Object
34 35 36 |
# File 'app/components/govuk_component/tabs.rb', line 34 def default_classes %w(govuk-tabs__panel) end |
#hidden_class(i = nil) ⇒ Object
38 39 40 |
# File 'app/components/govuk_component/tabs.rb', line 38 def hidden_class(i = nil) %(govuk-tabs__panel--hidden) unless i&.zero? end |
#id(prefix: nil) ⇒ Object
30 31 32 |
# File 'app/components/govuk_component/tabs.rb', line 30 def id(prefix: nil) [prefix, title.parameterize].join end |