Class: Shadcn::BadgeComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::BadgeComponent
- Defined in:
- app/components/shadcn/badge_component.rb
Overview
Badge component for labels and status indicators Matches shadcn/ui Badge component
Constant Summary collapse
- VARIANTS =
Available badge variants
{ default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80", secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", destructive: "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80", outline: "text-foreground" }.freeze
- BASE_CLASSES =
"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
-
#initialize(variant: :default, **options) ⇒ BadgeComponent
constructor
A new instance of BadgeComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(variant: :default, **options) ⇒ BadgeComponent
Returns a new instance of BadgeComponent.
27 28 29 30 |
# File 'app/components/shadcn/badge_component.rb', line 27 def initialize(variant: :default, **) super(**) @variant = variant.to_sym end |