// Generated by scripts/generate-showcase.mjs. Do not edit directly. page BadgeDetail { layout = "showcase" state playground_label = ctx.url.searchParams.get("pg_label") ?? "Badge" state playground_size = ctx.url.searchParams.get("pg_size") ?? "md" state playground_color = ctx.url.searchParams.get("pg_color") ?? "primary" 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") ?? "showcase-instance showcase-instance--1" 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") === "true" state playground_dotOnly = (ctx.url.searchParams.get("pg_dotOnly") ?? "false") === "true" state playground_dotLabel = ctx.url.searchParams.get("pg_dotLabel") ?? "Badge" state playground_animated = (ctx.url.searchParams.get("pg_animated") ?? "false") === "true" 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") ?? "true") === "true" state playground_dismissLabel = ctx.url.searchParams.get("pg_dismissLabel") ?? "Badge" state playground_truncate = (ctx.url.searchParams.get("pg_truncate") ?? "false") === "true" state playground_maxWidth = ctx.url.searchParams.get("pg_maxWidth") ?? "12rem" state playground_anchorLabel = ctx.url.searchParams.get("pg_anchorLabel") ?? "Badge" 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 outputsTheme readyResponsive
Interactive playground

Configure Badge

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

Live preview
Component code
<Badge
  dotLabel="Badge"
  dismissible="true"
  dismissLabel="Badge"
  anchorLabel="Badge"
/>
Event outputInteract with the preview to inspect the typed payload.
Component props22 controls
Live examples

Designed for real product surfaces

Compare configurations and resize the browser to check responsive behavior.

Recommended

Production default

Balanced spacing, hierarchy, and content for the most common product workflow.

01
Live preview
Component usage.wrn
<Badge
  dotLabel="Badge"
  dismissible="true"
  dismissLabel="Badge"
  anchorLabel="Badge"
/>
Dense UI

Compact application

A tighter variation for dashboards, side panels, tables, and operational interfaces.

02
Live preview
Component usage.wrn
<Badge
  label="Compact example"
  size="sm"
  variant="secondary"
  icon="icon-[lucide--arrow-right]"
  dotLabel="Compact example"
  dismissible="true"
  dismissLabel="Compact example"
  anchorLabel="Compact example"
/>
Extended

Rich configuration

A more expressive variation using additional data, stronger emphasis, and optional states.

03
Live preview
Component usage.wrn
<Badge
  label="Advanced example"
  size="lg"
  variant="success"
  icon="icon-[lucide--trash-2]"
  dotLabel="Advanced example"
  dismissible="true"
  dismissLabel="Advanced example"
  anchorLabel="Advanced example"
/>
Component outputs

Receive every typed component output

Use declarative output handlers in .wrn files or register a direct output handler from JavaScript. The canonical API exposes payload and does not require event.detail.

@dismissFires after the announcement or feedback surface is dismissed.
Declarative handlers.wrn
<Badge
  @dismiss='console.log(payload)'
/>
Direct output handlers.js
import { registerOutputHandler } from "@wrnexus/csr/outputs"

const component = document.querySelector("[data-ui-component=\"Badge\"], [data-component=\"Badge\"]")

if (component) registerOutputHandler(component, "dismiss", (payload) => {
  console.log("dismiss", payload)
})
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
} }