Class: Shadcn::ButtonGroup::Separator::Component

Inherits:
Separator::Component show all
Defined in:
app/components/shadcn/button_group/separator/component.rb

Overview

ButtonGroupSeparator renders a Separator rather than a bare element, and overrides three things about it: the data-slot, the default orientation, and a handful of classes layered on top of the separator's own — cn(separatorClasses, …) in the TSX.

Borrowing the parent's compiled classes rather than restating them is the same move PaginationLink makes with Button, and is why parity_spec lists this family as inheriting from separator.

Constant Summary collapse

EXTRA_CLASSES =
"relative m-0! self-stretch bg-input " \
"data-[orientation=vertical]:h-auto"

Constants inherited from ApplicationViewComponent

ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS

Instance Attribute Summary

Attributes inherited from Separator::Component

#decorative, #orientation

Attributes inherited from ApplicationViewComponent

#attributes

Instance Method Summary collapse

Methods inherited from Separator::Component

#element_attributes

Methods inherited from ApplicationViewComponent

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

Constructor Details

#initialize(orientation: :vertical, **attributes) ⇒ Component

Returns a new instance of Component.



20
21
22
# File 'app/components/shadcn/button_group/separator/component.rb', line 20

def initialize(orientation: :vertical, **attributes)
  super(orientation:, **attributes)
end

Instance Method Details

#css_classes(extra = nil) ⇒ Object



24
25
26
# File 'app/components/shadcn/button_group/separator/component.rb', line 24

def css_classes(extra = nil)
  super([ EXTRA_CLASSES, extra ].compact.join(" "))
end