Class: Shadcn::Tabs::List::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Tabs::List::Component
- Defined in:
- app/components/shadcn/tabs/list/component.rb
Overview
TabsList
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#variant ⇒ Object
readonly
Returns the value of attribute variant.
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #call ⇒ Object
- #element_attributes(**defaults) ⇒ Object
-
#initialize(variant: :default, **attributes) ⇒ Component
constructor
A new instance of Component.
- #style_variants ⇒ Object
Methods inherited from ApplicationViewComponent
#css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #tag_name
Constructor Details
#initialize(variant: :default, **attributes) ⇒ Component
Returns a new instance of Component.
32 33 34 35 |
# File 'app/components/shadcn/tabs/list/component.rb', line 32 def initialize(variant: :default, **attributes) @variant = variant&.to_sym || :default super(**attributes) end |
Instance Attribute Details
#variant ⇒ Object (readonly)
Returns the value of attribute variant.
30 31 32 |
# File 'app/components/shadcn/tabs/list/component.rb', line 30 def variant @variant end |
Instance Method Details
#call ⇒ Object
45 46 47 |
# File 'app/components/shadcn/tabs/list/component.rb', line 45 def call render_element(body: safe_join([ triggers, content ].flatten.compact)) end |
#element_attributes(**defaults) ⇒ Object
41 42 43 |
# File 'app/components/shadcn/tabs/list/component.rb', line 41 def element_attributes(**defaults) super(**{ role: "tablist", "data-variant" => variant }.merge(defaults)) end |
#style_variants ⇒ Object
37 38 39 |
# File 'app/components/shadcn/tabs/list/component.rb', line 37 def style_variants { variant: } end |