Skip to main content

Badge

The Badge component is a versatile and reusable component that allows us to display badges or labels in our app. We can customize it by passing various props to suit our component needs. In this guide, we'll walk through how to use the Badge component in codebase.

Importing the Badge Component

To use the Badge component in our app, we need to import it from our styled components. Here's how we can import it:

import { Badge } from "StyledComponents";

default badge

Using the Badge Component

The Badge component can be used with various props to control its appearance. Here are some examples of how we can use it:

<Badge
text="Paid"
/>

with text

<Badge
className="uppercase"
text="Paid"
/>

with class

<Badge
className="uppercase"
bgColor="bg-miru-alert-green-400"
text="Paid"
/>

with bgcolor

<Badge
className="mt-2 uppercase"
bgColor="bg-miru-alert-blue-400"
color="text-miru-alert-blue-1000"
text="Paid"
/>

with bgcolor

<Badge
className="bg-miru-alert-yellow-400 text-miru-alert-green-1000 mt-2 uppercase"
text="Paid"
/>

with class colors

Badge Component Props

NameDescriptionDefault Value
textProvide the name of the badge.Badge
colorSpecify the text color of the badge.text-purple-800
bgColorSpecify the background color of badge.bg-purple-100
classNameSpecify the extra style classes needed for Badge componentinline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold leading-4 tracking-widest