Skip to content

    Browse components

    Kbd

    Keyboard keys drawn as 3D keycaps that physically sink when the matching key is pressed, plus a group for shortcuts.

    Open
    Customize
    sm
    md
    lg

    Installation

    npx shadcn@latest add @glint-ui/kbd

    First time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/kbd.json

    Usage

    import { Kbd } from "@/components/ui/kbd";
    
    <KbdGroup separator="+">
      <Kbd>Mod</Kbd>
      <Kbd>K</Kbd>
    </KbdGroup>
    
    <Kbd size="sm">Esc</Kbd>

    Props

    PropTypeDefaultDescription
    size"sm" | "md" | "lg""md"Keycap size.
    listenbooleantrueAnimate a press when the matching physical key goes down.
    matchReactNode—KeyboardEvent.key to react to. Defaults to the text ("⌘", "Shift", "Esc", "Mod" = ⌘ on Mac, Ctrl elsewhere).
    pressedReactNode—Force the pressed look (boolean).
    childrenReactNode—Key label. KbdGroup takes Kbd children and an optional separator.
    classNamestring—Extra classes for the root element.