← All proposals

Badge

An extension of the PDS Badge: one new prop, as ('span' | 'kbd', default 'span').

Extends a PDS componentOpen in Storybook

proposals/Badge/context.md30 lines · View on GitHub

Badge

Problem

Global search shows an "esc" hint beside the field. PDS has no keyboard-key component, and the Badge always renders a span, so the hint had to put a <kbd> inside the Badge's label.

Proposal

An extension of the PDS Badge: one new prop, as ('span' | 'kbd', default 'span'). With kbd the badge itself is the <kbd>. Nothing else changes. Global search uses it for the Esc hint.

Challenge

  • Closest PDS component: Badge (the look and sizes are right; the element is fixed to span). No keyboard-key component exists in beta.21 (searched the reference).
  • Alternatives weighed: reuse existing (nest a <kbd> in the label: works today, and is what Global search did first, but the key is a span wrapping a kbd); new component (a Keyboard key component for Composer, menus and tooltips: bigger than this need, not asked for).
  • Verdict: extend. One prop, no new class, no new visual.

Source

Designer's request while building Global search, 2026-11-20. Replaces the earlier agentic-filled proposal, which was dropped when ai-active covered it (see _implemented/Badge/).

Constraints

  • Tokens only; no new visual.
  • Keep the package API and class names so the port stays a small change.

Open questions

  • Should as be a general element prop later (for example mark)? Not now: only span and kbd have a use.
  • Does PDS want a real keyboard-key component (Composer shortcuts, menu hints)? If so, this prop would go.