import { Canvas, Controls, Meta, Title } from '@storybook/addon-docs/blocks';
import * as BadgeStories from './Badge.stories';
<Meta of={BadgeStories} name='Usage' />
<Title />
## Purpose
Proposed addition to the existing PDS Badge: `as='kbd'` renders the badge as a `kbd` element, so a keyboard key hint (for example "esc" on a search field) is a real key and still looks like a Badge.
## Usage
- Use `as='kbd'` for a keyboard key or shortcut hint next to a control. Use the default `span` for every other badge.
- Pair it with a muted neutral color (`silver-muted`) and the `xs` size next to a field.
- Pass the key name as `label` from a translatable string. For a shortcut of several keys, use one badge per key.
- Do not use it for a status or a category. Use a normal Badge.
## Accessibility
- A `kbd` element is read as a key by assistive technology, with no extra role or label.
- A key hint beside a control is a hint for sighted keyboard users; the control must work and have its own label without it.
## Implementation
- `as`: `span` (default) or `kbd`
- `color`, `iconName`, `isWrappable`, `label`, `size`: unchanged from the PDS Badge
<hr />
<Canvas of={BadgeStories.KeyboardKey} />
<Controls of={BadgeStories.KeyboardKey} />
Badge
An extension of the PDS Badge: one new prop, as ('span' | 'kbd', default 'span').
Extends a PDS componentOpen in Storybook