Kbd Examples
39 keyboard key caps: ⌘K and Ctrl C shortcuts, arrow-key clusters, function keys, Mac symbols, key sequences, icons, sizes and pressed states. Each on React, Vue, Svelte and Solid, with Base UI, React Aria, Ark UI or Radix UI on React.
Every kbd example
39 examples.
- Active StatePressed StateA ⌘K group whose Command cap is filled with the primary color, as if that key were held, while K stays muted.

- Arrow Keys Cross PatternArrow KeysFour arrow caps in an inverted T on a three-column grid, matching the arrow cluster on a keyboard.

- Arrow Keys HorizontalArrow KeysLeft and right arrow caps side by side in one group, for a control that only moves along one axis.

- Arrow Keys with IconsWith IconsUp, down, left, and right caps drawn with arrow icons, each with a visually hidden name for assistive tech.

- Command Palette ShortcutShortcutThe ⌘K command palette hint as two grouped caps. The keys are a label, and this demo does not open a palette.

- Command with IconWith IconsA Command K shortcut whose Command key is an icon with a visually hidden name, grouped beside a K cap.

- Complex ShortcutShortcutCtrl, Shift, and P in one group, a three-key chord shown as labels. The demo does not listen for the keys.

- Copy ShortcutShortcutThe Ctrl C copy shortcut as two grouped caps. The hint is hard-coded, and this demo does not copy anything.

- Default KbdSizesA ⌘K shortcut at the default key cap size, two grouped caps with no custom height or type size.

- Delete with IconWith IconsA Del cap with a delete icon before the label. The icon is decorative, and the key does not delete anything.

- Disabled StatePressed StateA single ⌘ cap faded to half opacity, with a not-allowed cursor, for a shortcut that looks unavailable.

- Editing KeysFunction KeysHome, End, PgUp, and PgDn as four separate caps in a row, the editing keys for jumping through a long document.

Or describe it. With Pro, your AI agent installs the kbd example you describe, on your framework and UI library.
Get ProGalleries
More component examples
8 related galleries, free: open one for its live examples and their code.
Pricing
Kbd examples MCP, with Pro
Your AI agent installs any of the 1364 examples, and every component, block and icon, with every Pro plan.
4.9/5 out of 5 · 150+ reviewsfrom 150+ founders and developers.
- Secure checkout via Stripe
- Code lives in your repo
- Keep what you've shipped if you cancel
- License terms
FAQ
Frequently asked questions
Kbd draws a key cap for a keyboard key, and KbdGroup holds the keys of one shortcut together, like ⌘K. Each example here is shadcn.io's Kbd, which renders a real `kbd` element styled with Tailwind CSS, for React on Base UI, React Aria, Ark UI and Radix UI, and for Vue, Svelte and Solid on Ark UI.
Yes. Every example is free to use in personal and commercial projects, with no attribution. Seeing the code and installing it takes a free shadcn.io account.
A key cap is recognized as a key at a glance, where Ctrl+K in plain text is read as words. The `kbd` element also tells browsers and assistive technology that the text is keyboard input, and the cap keeps the same look in menus, tooltips, buttons and docs.
Next to the commands that have shortcuts: menu items, tooltips, the search field that opens a command palette, a shortcuts page. Show them where people will use them; a list nobody opens teaches nothing.
Mac users expect symbols, ⌘ ⌥ ⌃ ⇧, as macOS menus show them; Windows and Linux users expect words, Ctrl, Alt and Shift. The Platform-Aware Shortcut example switches between ⌘ and Ctrl for the user's device.
Put the keys pressed together in one KbdGroup, and show steps pressed one after another as separate caps or groups with then or an arrow between them, as the sequence examples do. The extra space keeps a sequence from reading as one chord.
Kbd has no size prop: its classes make it about as tall as a line of small text, and you change the size with classes on each cap, such as `h-8 min-w-8 text-base` for a large one. Keep the height and minimum width equal so single characters stay square.
Sign in with a free account, open the example and run the install command it shows. It adds the example and the Kbd component to your project, for your framework and UI library.
Test `navigator.userAgent` for Mac, iPhone or iPad after the component mounts, and show ⌘ when it matches and Ctrl otherwise. Rendering Ctrl first keeps a server render and the first client render the same, as the Platform-Aware Shortcut example does.
No. Kbd only draws the key: it doesn't listen for presses and ignores the pointer. Add a `keydown` listener for the shortcut yourself, and put a click action on a Button that shows the Kbd inside it.
shadcn.io's Kbd (for React on Base UI, React Aria, Ark UI or Radix UI, and on Ark UI in Vue, Svelte and Solid), Tailwind CSS, and Lucide icons in the examples with icons.
The keys are real text in `kbd` elements, so screen readers read them. Symbols like ⌘ or → aren't read the same way by every screen reader, so the icon examples hide the icon and add the key's name as visually hidden text; do the same wherever a shortcut matters.
Yes. All but one are static markup that renders the same on the server and the client in every framework. The Platform-Aware Shortcut example reads the browser's user agent, so it updates its label once it has mounted.
4.9 out of 5 from 150+ developers
Every kbd example. One prompt away.
Every kbd example is free with an account. With Pro, your AI agent installs them from a prompt.
Get Pro


















