Kbd
A key or shortcut the user can press.
Esc
Usage
import { Kbd } from '@epilot/spark-ui/kbd'<p>
Press <Kbd>⌘</Kbd> <Kbd>K</Kbd> to search your contracts.
</p>Use one Kbd per key. It renders a <kbd> element at the height of a
Badge, so it sits on a line of text without
pushing the line apart.
Examples
In text
Press ⌘ K to search your contracts.
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | — | The key label. |
className | string | — | Merges with the base styles. |
Other HTML element props pass through.
Accessibility
- Kbd renders a native
<kbd>element, so the key is part of the text and screen readers read it in place. - Screen readers read symbols such as
⌘or↵inconsistently, if at all. Where the key matters, name it in the surrounding text too, for examplePress Enter (<Kbd>↵</Kbd>).