Class: Shadcn::Item::Separator::Component

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

Overview

ItemSeparator renders a Separator with its own data-slot and one class on top, the way ButtonGroupSeparator does. Upstream pins the orientation to horizontal rather than defaulting it, so it is not a keyword here.

Constant Summary collapse

EXTRA_CLASSES =
"my-0"

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(**attributes) ⇒ Component

Returns a new instance of Component.



14
15
16
# File 'app/components/shadcn/item/separator/component.rb', line 14

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

Instance Method Details

#css_classes(extra = nil) ⇒ Object



18
19
20
# File 'app/components/shadcn/item/separator/component.rb', line 18

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