Class: Shadcn::Tabs::Content::Component

Inherits:
ApplicationViewComponent show all
Defined in:
app/components/shadcn/tabs/content/component.rb

Overview

TabsContent

Constant Summary

Constants inherited from ApplicationViewComponent

ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS

Instance Attribute Summary collapse

Attributes inherited from ApplicationViewComponent

#attributes

Instance Method Summary collapse

Methods inherited from ApplicationViewComponent

#call, #css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name

Constructor Details

#initialize(value:, **attributes) ⇒ Component

Returns a new instance of Component.



16
17
18
19
# File 'app/components/shadcn/tabs/content/component.rb', line 16

def initialize(value:, **attributes)
  @value = value.to_s
  super(**attributes)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14
15
16
# File 'app/components/shadcn/tabs/content/component.rb', line 14

def value
  @value
end

Instance Method Details

#element_attributes(**defaults) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'app/components/shadcn/tabs/content/component.rb', line 21

def element_attributes(**defaults)
  super(**{
    role: "tabpanel",
    tabindex: "0",
    hidden: true,
    "data-state" => "inactive",
    "data-value" => value,
    "data-shadcn--tabs-target" => "content"
  }.merge(defaults))
end