Class: Components::Bulma::TabComponents::Content

Inherits:
Base
  • Object
show all
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

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_templateObject



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