A styled keyboard key indicator for displaying keyboard shortcuts and key combinations.
A <kbd> element for rendering keyboard shortcuts and key indicators. It provides a compact, styled key cap appearance with muted background. Use KbdGroup to compose multi-key combinations.
import { Kbd, KbdGroup } from "@/components/ui/kbd"
export default function KbdDemo() {
return (
<KbdGroup>
<Kbd>Ctrl</Kbd>
<Kbd>K</Kbd>
</KbdGroup>
)
}
import { Kbd, KbdGroup } from "@/components/ui/kbd"<Kbd>K</Kbd><Kbd>Enter</Kbd>Use KbdGroup to display multi-key shortcuts.
<KbdGroup>
<Kbd>Ctrl</Kbd>
<Kbd>K</Kbd>
</KbdGroup>Kbd adapts its colors when placed inside a tooltip.
<Tooltip>
<TooltipTrigger>Search</TooltipTrigger>
<TooltipContent>
Search <Kbd>Ctrl+K</Kbd>
</TooltipContent>
</Tooltip>A styled <kbd> element that renders as an inline key cap.
| Prop | Type | Default |
|---|---|---|
className | string | — |
children | ReactNode | — |
A <kbd> wrapper that lays out multiple Kbd elements inline with consistent gap spacing.
| Prop | Type | Default |
|---|---|---|
className | string | — |
children | ReactNode | — |