Spelte

Open Github

Badge

A badge component with multiple color variants and sizes.

Default Secondary Outline Destructive

Installation

pnpm dlx shadcn-svelte@latest add https://spelte.dev/r/badge.json

Examples

Color

redbluegreenyellowpurplepinkorangecyan

Size

Small Default

Usage

<script>
	import Badge from '$registry/spelte/badge.svelte';
</script>
 
<Badge variant="blue">New</Badge>

Props

PropTypeDefaultDescription
childrenSnippetContent to display inside the badge
variant"default" | "secondary" | "outline" | "destructive" | "red" | "blue" | "green" | "yellow" | "purple" | "pink" | "orange" | "cyan" | "indigo" | "violet" | "rose" | "amber" | "lime" | "emerald" | "sky" | "slate" | "fuchsia""default"Color variant
size"sm" | "default""default"Size variant
classstringAdditional CSS classes