Skip to content

GhostBadge ​

GhostBadge is a compact, non-interactive label for short status and metadata values. Import it from @ghostvue/themes for the default visual treatment. To style your own badges, see Advanced: headless composition.

Release channels ​

Release channels

Badge variants and semantic tones marking release channel status inside a card.

Release channels Sample data
  • v2.14.0-stablePromoted across all production edges
    Recommended
  • v2.15.0-rc.2Canary validation in staging cluster
    Preview
  • v2.13.4-ltsSecurity maintenance window ends Dec 31
    Deprecated

Each release channel row ends in a themed GhostBadge from @ghostvue/themes. The status is in the badge text: Recommended, Preview and Deprecated. The solid, soft and outline variants and the accent, neutral and danger tones only add visual emphasis, so the list still reads correctly in grayscale, in forced colors and to a screen reader.

Basic use ​

The root is a native <span>. Slot text is the accessible name. The component adds no role and is not a tab stop, so a screen reader reads the badge as part of its row ("v2.13.4-lts … Deprecated").

Variants and tones ​

Themed

Visual props on the @ghostvue/themes wrapper.

DraftPaidDue soonOverdue

Importing the themed component loads the default stylesheet. Visual props exist only on this wrapper:

@ghostvue/themes adds these to the headless GhostBadge API, which it forwards:

PropTypeDefaultDescription
variant'solid' | 'soft' | 'outline' | 'ghost'"soft"Visual treatment. The default omits data-variant so CSS can treat a missing hook as soft.
tone'accent' | 'neutral' | 'danger' | 'success' | 'warning'"neutral"Semantic color intent, independent of variant and not a status vocabulary. success and warning use the status tokens and are Badge-only; Button tones stay accent, neutral, and danger. The default omits data-tone.
size'sm' | 'md'"sm"Compact type and padding. The default omits data-size so CSS can treat a missing hook as sm. Does not use control minimum sizes.

Defaults omit the matching data-* attribute so CSS can treat a missing hook as soft / neutral / sm.

tone picks a color, not a status. Put the status in the slot (Paid, Overdue) and choose the tone that matches it:

  • neutral for drafts, counts, and plain metadata.
  • success for settled or healthy states, such as paid or published.
  • warning for states that need attention soon, such as due soon or refunded.
  • danger for failures and overdue items.
  • accent for brand emphasis, such as a featured or recommended item.

Do not use accent to mean success. It follows the brand color, so it turns purple in Vibrant and is close to neutral in Mono. success and warning take their colors from the --ghost-status-success-* and --ghost-status-warning-* tokens, so they look the same whatever the accent is. They have no gradient in the solid variant.

Badge has two tones that themed GhostButton does not: success and warning. There is no info tone. Domain status belongs in the text (and in any data-* attributes you own).

Themed badges do not use control minimum sizes. Those minima are touch targets and would make table-cell badges too tall. Applications that wrap a badge in a control own that control's target size.

Icons ​

Optional decorative icons live in the default slot and opt into theme sizing with data-part="icon". Hide them from assistive technology.

Icon

Optional decorative icon marked data-part=icon.

Live

Icon-only badges need real text, typically via GhostVisuallyHidden. Do not put aria-label on the badge span: a role-less <span> cannot host it. Color and iconography must not be the only encoding of meaning.

Table cells, counts, and filters ​

Cell statuses, numeric counts, and active-filter summaries are the first DataTable uses. Keep the strings short.

Table and filters

Cell statuses, counts, and active-filter summaries.

Status: OpenPriority: High

Reports
NameStatusCount
Q3 revenueActive12
Q4 forecastOverdue3

When not to use it ​

  • Anything clickable, toggleable, or dismissible. Use GhostButton or a later chip/filter control. This component does not add tabindex, click handling, or a close affordance.
  • As a live region. Do not set role="status" on the badge. If a change must be announced, put aria-live on a container you own.
  • As the only encoding of status. A red unlabeled mark is not a badge.

Accessibility and environment behavior ​

Assistive technology encounters ordinary phrasing content. The badge is not a tab stop and adds no keyboard behavior. SSR markup is deterministic from slot content and themed visual props. Setup does not read browser globals.

See the GhostBadge specification for the complete behavior and compatibility contract.

Advanced: headless composition ​

For teams that bring their own design system, the headless GhostBadge from @ghostvue/vue renders the same <span> with no visuals.

Headless badge ​

Basic Headless

Unstyled compact status text.

Active

Composable ​

useGhostBadge returns rootProps for a <span> you render yourself. The GhostBadge reference page renders the badge/composable example with its source.

Styling ​

The unstyled component renders one native <span> with class ghost-badge and data-part="root". There is no data-state hook and no internal wrapper to target.

css
.ghost-badge [data-part='icon'] {
  /* Optional decorative icon. */
}

You can also import the stylesheet and wrap unstyled badges in .ghost-theme when you want a region of headless components to pick up the defaults. See the default theme guide for tokens and overrides.

API ​

SlotSlot propsDescription
default—Short status or metadata text and optional decorative icon content. Icon-only use needs real hidden text (GhostVisuallyHidden), not aria-label on the span.

The unstyled component declares no behavioral props. All native span attributes and event listeners fall through to the root. The default slot is the only content slot. The component does not generate an id; pass one as a native attribute when you need it. There is no model.