Skip to content
portalbits
Home Docs GitHub(opens in a new tab)

Guides

Get startedFoundationsMotion

Components

All components

Buttons

ButtonIconButton

Inputs

InputSelectTextareaSlider

Selection

CheckboxToggleToggleGroupSwitchRadioGroup

Identity

AvatarBadge

Overlays

DialogPopoverTooltipDropdownMenuAlertDialog

Disclosure

TabsAccordion

Cards

AppCardArticleCardFeatureCard

Content

CarouselSectionHeaderEmptyStateAlertProgressSeparatorRowListRow

Chrome

PortalShellSidebarNavMobileNavTopBarAuthFrameColorSelectorFloatingNav

Badge

A short noninteractive label for status and emphasis.

Neutral
Variations

Source

<script lang="ts">
  import 'portal-bits/styles.css';
  import 'portal-bits/tokens.css';
  import type { Snippet } from 'svelte';

  let { children }: { children: Snippet } = $props();
</script>

{@render children()}
<script lang="ts">
  import BadgeExample from './BadgeExample.svelte';
</script>

<BadgeExample variant={"neutral"} />
<script lang="ts">
  import { Badge } from 'portal-bits';
  let { variant = 'neutral' }: { variant?: 'neutral' | 'spotlight' | 'success' } = $props();
  const text = { neutral: 'Neutral', spotlight: 'Featured', success: 'Available' };
</script>

<Badge {variant}>{text[variant]}</Badge>

API reference

These tables list the props and snippets that Badge declares. Attributes passed through to an element or primitive are listed under Forwarded attributes, not here.

Props

NameTypeDefaultRequiredBindingDescription
variant'neutral' | 'spotlight' | 'success'neutralNoOne-wayVisual emphasis.

Snippets

NameTypeDefaultRequiredBindingDescription
childrenSnippetNoneNoOne-wayThe label text.

Forwarded attributes

None. Badge forwards no attributes.

No data attributes are documented as stable.

Limits

  • Not interactive. It renders a `span` and takes no attributes.
  • The variant colors are fixed. They do not follow the accent.

Related

  • Avatar
  • AppCard
Previous Avatar Next Dialog

On this page

  • Preview
  • Source
  • API reference
  • Props
  • Snippets
  • Forwarded attributes
  • Limits