Class: UI::BadgeComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::BadgeComponent
- Includes:
- BadgeBehavior
- Defined in:
- app/view_components/ui/badge_component.rb
Overview
Badge - ViewComponent implementation
Displays a badge or a component that looks like a badge.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(variant: :default, classes: "", **attributes) ⇒ BadgeComponent
constructor
A new instance of BadgeComponent.
Methods included from BadgeBehavior
#badge_classes, #badge_html_attributes
Constructor Details
#initialize(variant: :default, classes: "", **attributes) ⇒ BadgeComponent
Returns a new instance of BadgeComponent.
12 13 14 15 16 |
# File 'app/view_components/ui/badge_component.rb', line 12 def initialize(variant: :default, classes: "", **attributes) @variant = variant @classes = classes @attributes = attributes end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 |
# File 'app/view_components/ui/badge_component.rb', line 18 def call tag.span(**badge_html_attributes.deep_merge(@attributes)) do content end end |