Kbd
Press ⌘ K to search.
npx shadcn add @klarhimmel/kbdCopy for AIDetailsAbout, usage, props and more
A keyboard key, for shortcuts in text and menus.
When to use
Use for
Keyboard shortcuts in text and menus.
Not for
Decoration.
Pairs with
Search triggers, help text.
Preview
- Search the rooms: ⌘ K
- New booking: N
- Close anything open: Esc
Import
Import
- Files
- kbd.tsx, in components/klarhimmel/ui/. With it: theme, utils.
- Render in
- Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | required | Required. The key. |
className | string | - | Extra classes, merged after the component's own. |
Accessibility
| Key | Does |
|---|---|
Tab | Skips it: Kbd only displays a key |
Screen readers read the key as text. Write what it does next to it.
Accessibility