Docs
Badge
Badge
Displays a badge or a component that looks like a badge.
Loading...
<script lang="ts">
import { Badge } from "@/components/ui/badge";
</script>
<Badge>Badge</Badge>
<script lang="ts">
import { Badge } from "@/components/ui/badge";
</script>
<Badge>Badge</Badge>
Installation
npx shadcn-svelte add badge
Usage
<script lang="ts">
import { Badge } from "$components/ui/badge";
</script>
<Badge variant="outline">Badge</Badge>
Link
You can use the badgeVariants
helper to create a link that looks like a badge.
<script lang="ts">
import { badgeVariants } from "$components/ui/badge";
</script>
<a href="/dashboard" class={badgeVariants({ variant: "outline" })}>Badge</a>
Examples
Default
Loading...
<script lang="ts">
import { Badge } from "@/components/ui/badge";
</script>
<Badge>Badge</Badge>
<script lang="ts">
import { Badge } from "@/components/ui/badge";
</script>
<Badge>Badge</Badge>
Secondary
Loading...
<script lang="ts">
import { Badge } from "@/components/ui/badge";
</script>
<Badge variant="secondary">Secondary</Badge>
<script lang="ts">
import { Badge } from "@/components/ui/badge";
</script>
<Badge variant="secondary">Secondary</Badge>
Outline
Loading...
<script lang="ts">
import { Badge } from "@/components/ui/badge";
</script>
<Badge variant="outline">Outline</Badge>
<script lang="ts">
import { Badge } from "@/components/ui/badge";
</script>
<Badge variant="outline">Outline</Badge>
Destructive
Loading...
<script lang="ts">
import { Badge } from "@/components/ui/badge";
</script>
<Badge variant="destructive">Destructive</Badge>
<script lang="ts">
import { Badge } from "@/components/ui/badge";
</script>
<Badge variant="destructive">Destructive</Badge>
On This Page