Badge
Reusable badge component.
Usage
Components are auto-discovered. Use the component directly in any .wrn view:
<Badge
label="label"
variant="neutral"
/>Legacy mount name: data-component="Badge".
Props and attributes
| Prop | Type | Requirement | Default |
|---|---|---|---|
class | string | Optional | "" |
label | string | Optional | "" |
variant | string | Optional | "neutral" |
Slots
default
Events
This component does not declare a custom event.
Source contract
Installed source: components/Badge.wrn
component Badge {
props {
class = ""
label = ""
variant = "neutral"
size = "md"
}
view {
<span class="wire-badge wire-badge--{variant} wire-badge--{size} {class}">
{#if variant === "success"}
<span class="size-1.5 rounded-full bg-[var(--wire-color-success)]" aria-hidden="true">
</span>
{/if}
{#if variant === "warning"}
<span class="size-1.5 rounded-full bg-[var(--wire-color-warning)]" aria-hidden="true">
</span>
{/if}
{#if variant === "danger"}
<span class="size-1.5 rounded-full bg-[var(--wire-color-danger)]" aria-hidden="true">
</span>
{/if}
{#if variant === "brand"}
<span class="size-1.5 rounded-full bg-[var(--wire-color-primary)]" aria-hidden="true">
</span>
{/if}
<span>{label}</span>
<slot />
</span>
}
}