Class: ShadcnPhlexcomponents::Separator

Inherits:
Base
  • Object
show all
Defined in:
lib/shadcn_phlexcomponents/components/separator.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(orientation: :horizontal, **attributes) ⇒ Separator

Returns a new instance of Separator.



17
18
19
20
# File 'lib/shadcn_phlexcomponents/components/separator.rb', line 17

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

Instance Method Details

#default_attributesObject



22
23
24
25
26
27
28
29
# File 'lib/shadcn_phlexcomponents/components/separator.rb', line 22

def default_attributes
  {
    role: "none",
    data: {
      orientation: @orientation,
    },
  }
end

#view_templateObject



31
32
33
# File 'lib/shadcn_phlexcomponents/components/separator.rb', line 31

def view_template
  div(**@attributes)
end