Class: Ui::Badge::Component
- Inherits:
-
Ui::BaseComponent
- Object
- Ui::BaseComponent
- Ui::Badge::Component
- Defined in:
- lib/uikit_rails/templates/components/badge/component.rb
Overview
Small status indicator with variant styles.
Constant Summary collapse
- VARIANTS =
%i[default secondary destructive outline].freeze
Instance Attribute Summary collapse
-
#html_attrs ⇒ Object
readonly
Returns the value of attribute html_attrs.
-
#variant ⇒ Object
readonly
Returns the value of attribute variant.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(variant: :default, **html_attrs) ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize(variant: :default, **html_attrs) ⇒ Component
Returns a new instance of Component.
11 12 13 14 15 |
# File 'lib/uikit_rails/templates/components/badge/component.rb', line 11 def initialize(variant: :default, **html_attrs) @variant = variant.to_sym @html_attrs = html_attrs super() end |
Instance Attribute Details
#html_attrs ⇒ Object (readonly)
Returns the value of attribute html_attrs.
9 10 11 |
# File 'lib/uikit_rails/templates/components/badge/component.rb', line 9 def html_attrs @html_attrs end |
#variant ⇒ Object (readonly)
Returns the value of attribute variant.
9 10 11 |
# File 'lib/uikit_rails/templates/components/badge/component.rb', line 9 def variant @variant end |
Instance Method Details
#call ⇒ Object
17 18 19 |
# File 'lib/uikit_rails/templates/components/badge/component.rb', line 17 def call content_tag(:span, content, **computed_attrs) end |