- Accordion
- Alert
- Avatar PRO
- Avatar Group PRO
- Badge
- Blank Slate PRO
- Breadcrumb
- Breakpoint Debug PRO
- Button
- Button Group
- Callout PRO
- Card
- Carousel
- Close Button
- Container
- Copy to Clipboard PRO
- Divider PRO
- Dropdown
- Errors PRO
- Feed PRO
- Flash PRO
- Form Field PRO
- Header PRO
- Heading
- Heading with Anchor PRO
- List Group
- Modal
- Nav
- Navbar
- Offcanvas
- Pagination
- Pricing Panel PRO
- Progress
- Progress Circular PRO
- Rating Group PRO
- Ribbon PRO
- Spinner
- Stat PRO
- Stepper PRO
- Table
- Table of Contents PRO
- Team Member PRO
- Testimonial PRO
- Toast
Badge
Description
Badge visually represents additional information such as notification counts or status indicators within an interface element.
FREE
This component is available for free.
It implements the Bootstrap Badge component.
See the installation instructions below for more details.
Arguments
Name | Default | Type | Description |
---|---|---|---|
pill
|
Boolean
|
Pill variant of the component | |
color
|
primary
|
String
|
The color variant of the alert component
Options: primary , secondary , success , danger , warning , info , light , dark
|
html_attributes
|
{}
|
Hash
|
Any attributes for the used html wrapper tag |
Examples
Default
<%= render Railsboot::BadgeComponent.new(color: "primary").with_content("Badge") %>
<%= render Railsboot::BadgeComponent.new(color: "secondary").with_content("Badge") %>
<%= render Railsboot::BadgeComponent.new(color: "success").with_content("Badge") %>
<%= render Railsboot::BadgeComponent.new(color: "danger").with_content("Badge") %>
<%= render Railsboot::BadgeComponent.new(color: "warning").with_content("Badge") %>
<%= render Railsboot::BadgeComponent.new(color: "info").with_content("Badge") %>
<%= render Railsboot::BadgeComponent.new(color: "light", class: "text-bg-light").with_content("Badge") %>
<%= render Railsboot::BadgeComponent.new(color: "dark").with_content("Badge") %>
<span class="badge bg-primary">Badge</span>
<span class="badge bg-secondary">Badge</span>
<span class="badge bg-success">Badge</span>
<span class="badge bg-danger">Badge</span>
<span class="badge bg-warning">Badge</span>
<span class="badge bg-info">Badge</span>
<span class="badge bg-light text-bg-light">Badge</span>
<span class="badge bg-dark">Badge</span>
Pills
<%= render Railsboot::BadgeComponent.new(color: "primary", pill: true).with_content("Badge") %>
<%= render Railsboot::BadgeComponent.new(color: "secondary", pill: true).with_content("Badge") %>
<%= render Railsboot::BadgeComponent.new(color: "success", pill: true).with_content("Badge") %>
<%= render Railsboot::BadgeComponent.new(color: "danger", pill: true).with_content("Badge") %>
<%= render Railsboot::BadgeComponent.new(color: "warning", pill: true).with_content("Badge") %>
<%= render Railsboot::BadgeComponent.new(color: "info", pill: true).with_content("Badge") %>
<%= render Railsboot::BadgeComponent.new(color: "light", pill: true, class: "text-bg-light").with_content("Badge") %>
<%= render Railsboot::BadgeComponent.new(color: "dark", pill: true).with_content("Badge") %>
<span class="badge bg-primary rounded-pill">Badge</span>
<span class="badge bg-secondary rounded-pill">Badge</span>
<span class="badge bg-success rounded-pill">Badge</span>
<span class="badge bg-danger rounded-pill">Badge</span>
<span class="badge bg-warning rounded-pill">Badge</span>
<span class="badge bg-info rounded-pill">Badge</span>
<span class="badge bg-light rounded-pill text-bg-light">Badge</span>
<span class="badge bg-dark rounded-pill">Badge</span>
Installation
Simply download this component with all its related files and assets. Unpackage the downloaded ZIP-file, copy all relevant files into your app and adapt the things you need. The ZIP-folder contains:
- A parent component class (
app/components/railsboot/component.rb
) of which all components inherit from. - A base component class (
app/components/railsboot/base_component.rb
) which is used for rendering internally. - The desired component itself (
app/components/railsboot/badge_component.rb
). - A view template (
app/components/railsboot/badge_component.html.erb
) for the component unless it's rendered inline. - Any other dependent components such as Slots (just if the component needs those)
- Any dependent assets (JS-Files, CSS-Files) (just if the component needs those)
- A test file for the components (
test/components/railsboot/badge_component_test.rb
) including potential slot or dependency tests.
For more information please refer to the installation section.
Download
Download the component and its related files (e.g. templates, assets, slots etc.), unpackage the zip file and adapt the things you need.