Class: Components::Bulma::TabComponents::Content
- Defined in:
- lib/components/bulma/tab_components/content.rb
Overview
# Content
This component represents a single content section within the Bulma Tabs component.
## Arguments:
-
‘id`: Unique identifier for the content.
-
‘active`: Boolean indicating if the content is currently active.
-
‘data_attributes_proc`: A proc that generates data attributes for the content.
Instance Method Summary collapse
-
#initialize(id:, active:, data_attributes_proc: nil) ⇒ Content
constructor
A new instance of Content.
- #view_template ⇒ Object
Constructor Details
#initialize(id:, active:, data_attributes_proc: nil) ⇒ Content
Returns a new instance of Content.
15 16 17 18 19 20 |
# File 'lib/components/bulma/tab_components/content.rb', line 15 def initialize(id:, active:, data_attributes_proc: nil) @id = id @active = active @data_attributes = data_attributes_proc || Components::Bulma::Tabs::StimulusDataAttributes.new("bulma--tabs").method(:for_content) end |
Instance Method Details
#view_template ⇒ Object
22 23 24 25 26 |
# File 'lib/components/bulma/tab_components/content.rb', line 22 def view_template(&) div(id: @id, class: @active ? "" : "is-hidden", data: @data_attributes.call(@id), &) end |