Badge

A small label used to highlight an item's status or category for quick recognition.

Anatomy

<script>
  import { Badge } from "@saas-ui/svelte/components/badge";
</script>

<Badge>Default</Badge>
<Badge variant="solid" colour="green">Success</Badge>
<Badge variant="outline" colour="blue">Info</Badge>
<Badge variant="subtle" colour="red">Error</Badge>

Examples

Basic Accessibility

Basic badge with default styling for simple labeling.

Colours Accessibility

Use the colour prop to change the colour of the badge. Supports all standard colour palettes.

Sizes Accessibility

Use the size prop to change the size of the badge. Available sizes: xs, sm, md, lg.

Variants Accessibility

Use the variant prop to change the visual style. Available variants: subtle, solid, outline, surface.

With Icon Accessibility

Badges with icons for added visual context and meaning.

Props

Prop Type Default Description
variant subtle | solid | outline | surface solid The visual style of the component.
size xs | sm | md | lg sm The size of the component.
colour accent | gray | zinc | neutral | stone | slate | red | orange | amber | yellow | lime | green | emerald | teal | cyan | sky | blue | indigo | violet | purple | fuchsia | pink | rose gray The colour theme of the component.
children any - The content to be rendered inside the component.
class text - Additional CSS classes to apply.