Kbd

Shows a key or a key combination for an action.

React, Vue, Solid, and Svelte

Shift + Tab

A kbd element styled with the kbd recipe. Pick a variant and a size, and set colorPalette to change its color. KbdGroup wraps the keys of one shortcut and passes its size and variant to every Kbd inside.

Usage

import { Kbd } from "@isbatak/react-ui/kbd"

export function KbdDemo() {
  return <Kbd>Shift + Tab</Kbd>
}
<Kbd>F12</Kbd>

Examples

Combinations

Put the keys of a combination side by side, with the separator as plain text.

Ctrl+Shift+Del

Group

Wrap the keys of a shortcut in KbdGroup. Its size and variant apply to every key inside, and it renders a kbd too, so the whole shortcut reads as one input to assistive technology.

⌘KCtrl+Shift+P

Function keys

Modifier symbols are single characters, so each key keeps the recipe's minimum width and stays square.

⌘⌥⇧⌃

Variants

Set variant to raised, outline, subtle or plain. The default is raised.

Shift + TabShift + TabShift + TabShift + Tab

Sizes

Set size to sm, md or lg. The default is md.

Shift + TabShift + TabShift + Tab

Within text

Kbd is inline, so it sits in a sentence without extra markup.

Press F12 to open the developer tools.

Recipe

VariantValuesDefault
variantraised, outline, subtle, plainraised
sizesm, md, lgmd