CarouselData Table
Get Started
Introduction
Components
Accordion
Badge
Button
Card
Checkbox
Command
Dialog
Dropdown Menu
Input
Select
Switch
Table
Tabs
Toast
Tooltip
Forms
Introduction
Validation
Field Arrays

Displays a keyboard key or keyboard shortcut.

#Installation

bunx --bun barefoot add kbd

#Usage

KCtrlCEnterShiftEsc
1import { Kbd, KbdGroup } from "@/components/ui/kbd"23function KbdDemo() {4  return (5    <div className="flex flex-wrap items-center gap-4">6      <KbdGroup>7        <Kbd>⌘</Kbd>8        <Kbd>K</Kbd>9      </KbdGroup>1011      <Kbd>Enter</Kbd>12      <Kbd>Shift</Kbd>13      <Kbd>Esc</Kbd>14    </div>15  )16}

#Examples

#KbdGroup

CtrlShiftP
<KbdGroup>
  <Kbd>Ctrl</Kbd>
  <Kbd>Shift</Kbd>
  <Kbd>P</Kbd>
</KbdGroup>

#Shortcuts

SearchK
CopyC
PasteV
UndoZ
1import { Kbd, KbdGroup } from "@/components/ui/kbd"23function ShortcutsList() {4  return (5    <div className="w-full max-w-sm space-y-3">6      <div className="flex items-center justify-between">7        <span className="text-sm text-muted-foreground">Search</span>8        <KbdGroup>9          <Kbd>⌘</Kbd>10          <Kbd>K</Kbd>11        </KbdGroup>12      </div>13      <div className="flex items-center justify-between">14        <span className="text-sm text-muted-foreground">Copy</span>15        <KbdGroup>16          <Kbd>⌘</Kbd>17          <Kbd>C</Kbd>18        </KbdGroup>19      </div>20    </div>21  )22}

#API Reference

Kbd

PropTypeDefaultDescription
asChildbooleanfalseRender child element with kbd styling instead of <kbd>.
childrenChild-The key label content.

KbdGroup

PropTypeDefaultDescription
asChildbooleanfalseRender child element with group styling instead of <kbd>.
childrenChild-The grouped key elements.