Kbd
A keyboard key, alone or as the keys of one shortcut.
Press⌘Kto search
Installation
npm i @uisatin/uiimport { Kbd } from '@uisatin/ui/kbd'About 10.3 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.
npx shadcn@latest add https://uisatin.dev/r/kbd.jsonAdds kbd.tsx to components/ui.
First time with Satin? Set it up once, styles and fonts included, with the installation guide.
API Reference
The Kbd component renders a kbd element for one key. KbdGroup splits a shortcut such as "⇧⌘P" into keys 2px apart.
| Prop | Type | Default |
|---|---|---|
size | "sm""md" | "sm" |
tone | "default""inverse" | "default" |
children | ReactNode | — |
group.keys | stringReactNode[] | — |
className | string | — |
ref | Ref<HTMLElement> | — |
...props | ComponentProps<'kbd'>Other attributes go to <kbd> | — |
Accessibility
A native kbd element, read as its text; screen readers may say symbols such as ⌘ in different ways. KbdArrowUp, KbdArrowDown and KbdReturn are hidden glyphs with no text, so add words for screen readers next to them, or hide the hint when the same help is spoken elsewhere.
Something wrong or missing on this page?
Report a problemSuggest an improvement