Badge Edit

Displays a badge or a component that looks like a badge.

Examples

Badge
Secondary
Destructive
Outline
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.