// 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 {
Base component

Badge

Theme-aware, responsive badge component.

22 props0 slots1 eventsTheme readyResponsive
Interactive playground

Configure Badge

Change any prop and inspect the server-rendered component immediately.

Live preview
Component code
<Badge
  label="Active"
  color="success"
/>
Component props22 controls
Live examples

Designed for real product surfaces

Compare configurations and resize the browser to check responsive behavior.

Color variants

Solid badge

Use a solid fill for a high-emphasis status or category.

01
Live preview
Component usage.wrn
<Badge
  label="Active"
  color="success"
/>
Color variants

Soft badge

Use a softer fill for a lower-contrast label.

02
Live preview
Component usage.wrn
<Badge
  label="In review"
  color="info"
  variant="soft"
/>
Color variants

Outline badge

Use an outlined treatment for lighter visual emphasis.

03
Live preview
Component usage.wrn
<Badge
  label="Attention"
  color="danger"
  variant="outline"
/>
Color variants

White badge

Use a neutral surface with a subtle border and shadow.

04
Live preview
Component usage.wrn
<Badge
  label="Neutral"
  color="dark"
  variant="white"
/>
Shape

Rounded badge

Use softly rounded corners instead of fully pilled edges.

05
Live preview
Component usage.wrn
<Badge
  label="Category"
  color="info"
  shape="rounded"
/>
Shape

Pill badge

Use a pill shape for compact labels and filter chips.

06
Live preview
Component usage.wrn
<Badge
  label="Pill badge"
/>
Content

Truncated badge

Constrain long badge text while preserving the full value in the API.

07
Live preview
Component usage.wrn
<Badge
  label="This content is a little too long for the available space"
  color="info"
  shape="rounded"
  truncate="true"
  maxWidth="10rem"
/>
Status

Badge with status dot

Add a small dot to reinforce status at a glance.

08
Live preview
Component usage.wrn
<Badge
  label="Connected"
  color="success"
  variant="soft"
  dot="true"
/>
Content

Badge with icon

Pair an icon with text for states, metrics, or trend changes.

09
Live preview
Component usage.wrn
<Badge
  label="14.5%"
  color="success"
  variant="soft"
  icon="icon-[lucide--trending-up]"
/>
Interaction

Dismissible badge

Provide a clear remove action for a selected chip.

010
Live preview
Component usage.wrn
<Badge
  label="Design"
  color="info"
  variant="soft"
  dismissible="true"
/>
Content

Badge with avatar

Combine a profile image, label, and optional remove action.

011
Live preview
Component usage.wrn
<Badge
  label="Christina"
  color="dark"
  variant="white"
  avatarSrc="/avatar-example-2.svg"
  avatarAlt="Christina"
  dismissible="true"
/>
Composition

Badge inside button

Place a badge beside a button label to show a count.

012
Live preview
Component usage.wrn
<Badge
  label="5"
  size="xs"
  color="danger"
  anchorLabel="Notifications"
  anchorLabelText="Open notifications"
/>
Composition

Positioned badge

Anchor a numeric badge to the corner of an icon button.

013
Live preview
Component usage.wrn
<Badge
  label="99+"
  size="xs"
  color="danger"
  anchorIcon="icon-[lucide--bell]"
  placement="top-right"
  anchorLabelText="Open notifications"
/>
Composition

Dot badge

Use a small dot when a notification does not need a count.

014
Live preview
Component usage.wrn
<Badge
  color="success"
  dotOnly="true"
  dotLabel="New notification"
  anchorIcon="icon-[lucide--bell]"
  placement="top-right"
  anchorLabelText="Open notifications"
/>
Animation

Ping badge

Pulse a notification badge while respecting reduced-motion preferences.

015
Live preview
Component usage.wrn
<Badge
  label="9+"
  color="danger"
  animated="true"
  anchorIcon="icon-[lucide--shopping-basket]"
  placement="top-right"
  anchorLabelText="Open cart"
/>
Component events

Events

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.
Event listener.js
const component = document.querySelector('[data-wrn-events]')

component.addEventListener('dismiss', (event) => {
  console.log(event.detail)
})
Component API

Props and configuration

All content and behavior shown above is supplied through these props and slots.

PropTypeDefaultRequired
labelstring"Badge"No
sizestring"md"No
colorstring"primary"No
variantstring"solid"No
shapestring"pill"No
classstring""No
iconstring""No
iconPositionstring"start"No
dotbooleanfalseNo
dotOnlybooleanfalseNo
dotLabelstring"Status"No
animatedbooleanfalseNo
avatarSrcstring""No
avatarAltstring""No
dismissiblebooleanfalseNo
dismissLabelstring"Remove badge"No
truncatebooleanfalseNo
maxWidthstring"12rem"No
anchorLabelstring""No
anchorIconstring""No
placementstring"inline"No
anchorLabelTextstring"Badge anchor"No
} }