Class: ShadcnPhlexcomponents::Tabs
- Inherits:
-
Base
- Object
- Phlex::HTML
- Base
- ShadcnPhlexcomponents::Tabs
show all
- Defined in:
- lib/shadcn_phlexcomponents/components/tabs.rb
Constant Summary
Constants inherited
from Base
Base::SANITIZER_ALLOWED_ATTRIBUTES, Base::SANITIZER_ALLOWED_TAGS, Base::TAILWIND_MERGER
Instance Method Summary
collapse
Methods inherited from Base
#before_template, #convert_collection_hash_to_struct, #find_as_child, #icon, #item_disabled?, #merge_default_attributes, #merged_as_child_attributes, #nokogiri_attributes_to_hash, #overlay, #sanitize_as_child
Constructor Details
#initialize(value: nil, dir: "ltr", **attributes) ⇒ Tabs
Returns a new instance of Tabs.
14
15
16
17
18
19
|
# File 'lib/shadcn_phlexcomponents/components/tabs.rb', line 14
def initialize(value: nil, dir: "ltr", **attributes)
@dir = dir
@value = value
@aria_id = "tabs-#{SecureRandom.hex(5)}"
super(**attributes)
end
|
Instance Method Details
#content(**attributes) ⇒ Object
29
30
31
|
# File 'lib/shadcn_phlexcomponents/components/tabs.rb', line 29
def content(**attributes, &)
TabsContent(aria_id: @aria_id, **attributes, &)
end
|
#default_attributes ⇒ Object
33
34
35
36
37
38
39
40
41
|
# File 'lib/shadcn_phlexcomponents/components/tabs.rb', line 33
def default_attributes
{
dir: @dir,
data: {
controller: "tabs",
tabs_active_value: @value,
},
}
end
|
#list(**attributes) ⇒ Object
21
22
23
|
# File 'lib/shadcn_phlexcomponents/components/tabs.rb', line 21
def list(**attributes, &)
TabsList(**attributes, &)
end
|
#trigger(**attributes) ⇒ Object
25
26
27
|
# File 'lib/shadcn_phlexcomponents/components/tabs.rb', line 25
def trigger(**attributes, &)
TabsTrigger(aria_id: @aria_id, **attributes, &)
end
|
#view_template ⇒ Object
43
44
45
|
# File 'lib/shadcn_phlexcomponents/components/tabs.rb', line 43
def view_template(&)
div(**@attributes, &)
end
|