Components

Badge

A compact label for statuses, counts, and categories.

Props

Native attributes and event handlers are forwarded to the span element.

Status variants include success, warning, error, and info. Badges are noninteractive labels.

PropTypeDefaultDescription
children Snippet undefined Content rendered inside the component.
class string '' Classes merged with theme styles and variants.
element HTMLSpanElement | null null Bindable reference to the native element.
inTransition TransitionProps undefined Entrance override; falls back to transition.
isVisible boolean true Bindable visibility; removing the component runs its exit transition.
outTransition TransitionProps undefined Exit override; falls back to transition.
theme Theme global theme Local theme override.
transition TransitionProps [noopTransition, {}] Transition function and optional parameters.
variants string[] [] Local variants or references to other theme styles.

Default usage

Import Badge from sveltewind/components. This example shows its default styling in a usable context.

New
+page.svelte
Loading...

Examples

Theme variants

Every variant available for Badge in the built-in themes is shown below.

error — Apply the error variant.

New
+page.svelte
Loading...

info — Apply the info variant.

New
+page.svelte
Loading...

success — Apply the success variant.

New
+page.svelte
Loading...

warning — Apply the warning variant.

New
+page.svelte
Loading...

outline — Apply the outline variant.

New
+page.svelte
Loading...

pill — Apply the pill variant.

New
+page.svelte
Loading...

square — Apply the square variant.

New
+page.svelte
Loading...

Class overrides

Apply rounded-full font-semibold shadow-sm locally.

New
+page.svelte
Loading...

Props and behavior

Change title while retaining the default component styling.

New
+page.svelte
Loading...

Content and values

Provide different text, child content, or definitions inside the required parent context.

Your project content
+page.svelte
Loading...
Active Pending Failed 3 updates
+page.svelte
Loading...