HextaUI

Kbd: Variants

keycap has a hairline edge and a 1px lip so it reads as a physical key. flat is a quiet fill for dense places like menus.

CommandCCommandC
import { KbdGroup } from "@/components/ui/kbd"

export function KbdVariants() {
  return (
    <div className="flex flex-wrap items-center justify-center gap-6">
      <KbdGroup keys="mod+c" />
      <KbdGroup keys="mod+c" variant="flat" />
    </div>
  )
}

This adds the example as components/examples/kbd/variants.tsx, together with the Kbd component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/kbd-variants.json

To add only the component, follow the Kbd installation.

Props in this example

The Kbd props this example sets, from the API reference.

PropTypeDefault
keysKeys joined with +, like "mod+shift+p". mod is ⌘ on Apple devices and Ctrl elsewhere. Names such as alt, enter, escape, up and space become symbols or short words, and get a spoken name for screen readers. Spaces separate the steps of a sequence.
string–
variantPassed to every cap inside.
"keycap" | "flat"–

Every prop is in the Kbd API reference.

See them all, with keyboard support and accessibility notes, on the Kbd page.