Class: ShadcnPhlexcomponents::Badge

Inherits:
Base
  • Object
show all
Defined in:
lib/shadcn_phlexcomponents/components/badge.rb

Constant Summary

Constants inherited from Base

ShadcnPhlexcomponents::Base::SANITIZER_ALLOWED_ATTRIBUTES, ShadcnPhlexcomponents::Base::SANITIZER_ALLOWED_TAGS, ShadcnPhlexcomponents::Base::TAILWIND_MERGER

Instance Method Summary collapse

Methods inherited from Base

#before_template, #convert_collection_hash_to_struct, #default_attributes, #find_as_child, #icon, #item_disabled?, #merge_default_attributes, #merged_as_child_attributes, #nokogiri_attributes_to_hash, #overlay, #sanitize_as_child

Constructor Details

#initialize(variant: :default, **attributes) ⇒ Badge

Returns a new instance of Badge.



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

def initialize(variant: :default, **attributes)
  @class_variants = { variant: variant }
  super(**attributes)
end

Instance Method Details

#view_template ⇒ Object



36
37
38
# File 'lib/shadcn_phlexcomponents/components/badge.rb', line 36

def view_template(&)
  span(**@attributes, &)
end