HextaUI

Kbd: Sizes

sm sits in small text, default next to body text and lg in headings or on its own.

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

const sizes = ["sm", "default", "lg"] as const

export function KbdSizes() {
  return (
    <div className="flex flex-wrap items-center justify-center gap-6">
      {sizes.map((size) => (
        <KbdGroup key={size} keys="mod+shift+z" size={size} />
      ))}
    </div>
  )
}

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

pnpm dlx shadcn@latest add https://hextaui.com/r/kbd-sizes.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–
sizePassed to every cap inside.
"sm" | "default" | "lg"–

Every prop is in the Kbd API reference.

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