Badge Edit
Displays a badge or a component that looks like a badge.
Examples
Badge
Secondary
Destructive
Outline
Ghost
<%= render_badge text: "Badge" %>
<%= render_badge text: "Secondary", variant: :secondary %>
<%= render_badge text: "Destructive", variant: :destructive %>
<%= render_badge text: "Outline", variant: :outline %>
<%= render_badge text: "Ghost", variant: :ghost %>
Installation
rails generate shadcn-ui badge
Usage
<%= render_badge text:, variant: %>
The Badge component introduces:
app/helpers/components/badge_helper.rb
app/views/components/ui/_badge.html.erb
The method render_badge
defined in app/helpers/components/badge_helper.rb
accepts a text:
required keyword argument along with an optional variant:
argument for the kind of badge to render.