Badge
Display additional information through labels or status indicators
Source ↗️ Report Issue ↗️Use badges for providing quick, contextual information to your users, such as notification counts, status or activity indicators, labels, priority levels, or even turn them into interactive chips using their onClick
prop.
Hover Effects
You can set hover
to true
or add the onClick
prop in Svelte or React to add hover effects to your badges. This is useful for interactive badges.
Badges with Icons
You can also pass the Icon
component or your own icons to the Badge
component to render them with icons:
Interactive Badges
To make badges interactive, you can use the onClick
prop for Svelte/React. For Astro, use the className
prop to assign a custom class name to the element that you can target with document.querySelector
, and add a click event listener using the native addEventListener
method:
API
Prop | Purpose |
---|---|
theme | Sets the theme of the badge. Defaults to null . |
hover | Adds hover effects if the badge needs to be interactive. Defaults to false . |
className | Pass additional CSS classes for the badge. |
Svelte & React Prop | Purpose |
---|---|
onClick | Attach on-click event listeners. If set, hover is treated as true . |
Request improvement for this page