Class: TabComponent

Inherits:
Component show all
Includes:
Attachable
Defined in:
app/components/tab_component.rb

Overview

Tab — a single content pane within a TabGroup.

Usage (inside TabGroup):

Tab(active: true, path: "first", attached: true, segment: true) {
  text "First tab content"
}

Usage (standalone, no TabGroup):

Tab(active: true, path: "first") { text "Pane content" }

Constant Summary

Constants inherited from Component

Component::HTML_OPTIONS

Instance Method Summary collapse

Methods inherited from Component

default, #initialize, #render_in, slot

Constructor Details

This class inherits a constructor from Component

Instance Method Details

#to_sObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/components/tab_component.rb', line 20

def to_s
  classes = class_names(
    "ui",
    { "active" => active,
      "bottom attached" => attached,
      "segment" => segment },
    "tab"
  )

  data = {}
  data[:tab] = path if path

  tag.div(**merge_html_options(class: classes, data: data)) { @content }
end