Class: Panda::Core::UI::Badge
- Defined in:
- app/components/panda/core/UI/badge.rb
Overview
Badge component for status indicators, labels, and counts.
Badges are small, inline elements that highlight an item's status or provide additional metadata at a glance.
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#removable ⇒ Object
readonly
Returns the value of attribute removable.
-
#rounded ⇒ Object
readonly
Returns the value of attribute rounded.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#variant ⇒ Object
readonly
Returns the value of attribute variant.
Instance Method Summary collapse
-
#initialize(text:, variant: :default, size: :medium, removable: false, rounded: false, **attrs) ⇒ Badge
constructor
A new instance of Badge.
- #removable? ⇒ Boolean
Constructor Details
#initialize(text:, variant: :default, size: :medium, removable: false, rounded: false, **attrs) ⇒ Badge
Returns a new instance of Badge.
30 31 32 33 34 35 36 37 |
# File 'app/components/panda/core/UI/badge.rb', line 30 def initialize(text:, variant: :default, size: :medium, removable: false, rounded: false, **attrs) @text = text @variant = variant @size = size @removable = removable @rounded = rounded super(**attrs) end |
Instance Attribute Details
#removable ⇒ Object (readonly)
Returns the value of attribute removable.
39 40 41 |
# File 'app/components/panda/core/UI/badge.rb', line 39 def removable @removable end |
#rounded ⇒ Object (readonly)
Returns the value of attribute rounded.
39 40 41 |
# File 'app/components/panda/core/UI/badge.rb', line 39 def rounded @rounded end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
39 40 41 |
# File 'app/components/panda/core/UI/badge.rb', line 39 def size @size end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
39 40 41 |
# File 'app/components/panda/core/UI/badge.rb', line 39 def text @text end |
#variant ⇒ Object (readonly)
Returns the value of attribute variant.
39 40 41 |
# File 'app/components/panda/core/UI/badge.rb', line 39 def variant @variant end |
Instance Method Details
#removable? ⇒ Boolean
41 42 43 |
# File 'app/components/panda/core/UI/badge.rb', line 41 def removable? removable end |