Flowbite::Badge
Renders a badge component for displaying labels, counts, or status indicators.
Basic usage
<%= render(Flowbite::Badge.new) { "Default" } %>
With border
<%= render(Flowbite::Badge.new(bordered: true, style: :success)) { "Success" } %>
Examples
Styles
Use these badge styles with multiple colors to indicate status or categories.
Bordered
Add a border accent in a matching color scheme.
Large
Increase the paddings to create a larger badge variant.
Pill
Make the corners even more rounded like pills.
Link
Use badges as anchor elements to link to another page.
Dot
Add a colored dot indicator before the badge text.
API reference
Flowbite
In namespace
Constructor
def initialize(bordered: false, class: nil, dot: false, href: nil, size: :default, style: :brand, **options)
Parameters
bordered |
Boolean | Whether to add a border to the badge. |
|---|---|---|
class |
String, Array<String> | Additional CSS classes. |
dot |
Boolean | Whether to show a dot indicator. |
href |
String | If provided, renders the badge as a link. |
size |
Symbol | The size of the badge (:default or :lg). |
style |
Symbol | The color style (:alternative, :brand, :danger, :gray, :success, :warning). |
See also
Ruby API documentation forclass Flowbite::Badge