Solid badge
Use a solid fill for a high-emphasis status or category.
<Badge
label="Active"
color="success"
/>
// Generated by scripts/generate-showcase.mjs. Do not edit directly.
page BadgeDetail {
layout = "showcase"
state playground_label = ctx.url.searchParams.get("pg_label") ?? "Active"
state playground_size = ctx.url.searchParams.get("pg_size") ?? "md"
state playground_color = ctx.url.searchParams.get("pg_color") ?? "success"
state playground_variant = ctx.url.searchParams.get("pg_variant") ?? "solid"
state playground_shape = ctx.url.searchParams.get("pg_shape") ?? "pill"
state playground_class = ctx.url.searchParams.get("pg_class") ?? ""
state playground_icon = ctx.url.searchParams.get("pg_icon") ?? ""
state playground_iconPosition = ctx.url.searchParams.get("pg_iconPosition") ?? "start"
state playground_dot = ctx.url.searchParams.get("pg_dot") ?? "false"
state playground_dotOnly = ctx.url.searchParams.get("pg_dotOnly") ?? "false"
state playground_dotLabel = ctx.url.searchParams.get("pg_dotLabel") ?? "Status"
state playground_animated = ctx.url.searchParams.get("pg_animated") ?? "false"
state playground_avatarSrc = ctx.url.searchParams.get("pg_avatarSrc") ?? ""
state playground_avatarAlt = ctx.url.searchParams.get("pg_avatarAlt") ?? ""
state playground_dismissible = ctx.url.searchParams.get("pg_dismissible") ?? "false"
state playground_dismissLabel = ctx.url.searchParams.get("pg_dismissLabel") ?? "Remove badge"
state playground_truncate = ctx.url.searchParams.get("pg_truncate") ?? "false"
state playground_maxWidth = ctx.url.searchParams.get("pg_maxWidth") ?? "12rem"
state playground_anchorLabel = ctx.url.searchParams.get("pg_anchorLabel") ?? ""
state playground_anchorIcon = ctx.url.searchParams.get("pg_anchorIcon") ?? ""
state playground_placement = ctx.url.searchParams.get("pg_placement") ?? "inline"
state playground_anchorLabelText = ctx.url.searchParams.get("pg_anchorLabelText") ?? "Badge anchor"
seo {
title = "Badge"
description = "Theme-aware, responsive badge component."
}
view {
Theme-aware, responsive badge component. Change any prop and inspect the server-rendered component immediately.Badge
Configure Badge
<Badge
label="Active"
color="success"
/>
Compare configurations and resize the browser to check responsive behavior.
Use a solid fill for a high-emphasis status or category.
<Badge
label="Active"
color="success"
/>
Use a softer fill for a lower-contrast label.
<Badge
label="In review"
color="info"
variant="soft"
/>
Use an outlined treatment for lighter visual emphasis.
<Badge
label="Attention"
color="danger"
variant="outline"
/>
Use a neutral surface with a subtle border and shadow.
<Badge
label="Neutral"
color="dark"
variant="white"
/>
Use softly rounded corners instead of fully pilled edges.
<Badge
label="Category"
color="info"
shape="rounded"
/>
Use a pill shape for compact labels and filter chips.
<Badge
label="Pill badge"
/>
Constrain long badge text while preserving the full value in the API.
<Badge
label="This content is a little too long for the available space"
color="info"
shape="rounded"
truncate="true"
maxWidth="10rem"
/>
Add a small dot to reinforce status at a glance.
<Badge
label="Connected"
color="success"
variant="soft"
dot="true"
/>
Pair an icon with text for states, metrics, or trend changes.
<Badge
label="14.5%"
color="success"
variant="soft"
icon="icon-[lucide--trending-up]"
/>
Provide a clear remove action for a selected chip.
<Badge
label="Design"
color="info"
variant="soft"
dismissible="true"
/>
Combine a profile image, label, and optional remove action.
<Badge
label="Christina"
color="dark"
variant="white"
avatarSrc="/avatar-example-2.svg"
avatarAlt="Christina"
dismissible="true"
/>
Place a badge beside a button label to show a count.
<Badge
label="5"
size="xs"
color="danger"
anchorLabel="Notifications"
anchorLabelText="Open notifications"
/>
Anchor a numeric badge to the corner of an icon button.
<Badge
label="99+"
size="xs"
color="danger"
anchorIcon="icon-[lucide--bell]"
placement="top-right"
anchorLabelText="Open notifications"
/>
Use a small dot when a notification does not need a count.
<Badge
color="success"
dotOnly="true"
dotLabel="New notification"
anchorIcon="icon-[lucide--bell]"
placement="top-right"
anchorLabelText="Open notifications"
/>
Pulse a notification badge while respecting reduced-motion preferences.
<Badge
label="9+"
color="danger"
animated="true"
anchorIcon="icon-[lucide--shopping-basket]"
placement="top-right"
anchorLabelText="Open cart"
/>
Public events declared by this component. Custom events bubble from the component root and expose state through event.detail.
@dismissFires when the component emits the dismiss event.const component = document.querySelector('[data-wrn-events]')
component.addEventListener('dismiss', (event) => {
console.log(event.detail)
})All content and behavior shown above is supplied through these props and slots.
| Prop | Type | Default | Required |
|---|---|---|---|
label | string | "Badge" | No |
size | string | "md" | No |
color | string | "primary" | No |
variant | string | "solid" | No |
shape | string | "pill" | No |
class | string | "" | No |
icon | string | "" | No |
iconPosition | string | "start" | No |
dot | boolean | false | No |
dotOnly | boolean | false | No |
dotLabel | string | "Status" | No |
animated | boolean | false | No |
avatarSrc | string | "" | No |
avatarAlt | string | "" | No |
dismissible | boolean | false | No |
dismissLabel | string | "Remove badge" | No |
truncate | boolean | false | No |
maxWidth | string | "12rem" | No |
anchorLabel | string | "" | No |
anchorIcon | string | "" | No |
placement | string | "inline" | No |
anchorLabelText | string | "Badge anchor" | No |