Components
Loading preview...
Display keyboard shortcuts with proper key symbols.
npx shadcn@latest add https://21st.dev/r/tom_ui/kbd"use client";
import { Kbd } from "@/components/ui/kbd";
export function KeyboardShortcutsDemo() {
return (
<div className="flex min-h-[400px] flex-col items-center justify-center gap-6 p-8">
<p className="text-sm text-muted-foreground">Focus the preview, then press Alt, Enter, Space, Ctrl+J, M, or ↑</p>
<div className="flex items-center justify-center gap-3 text-2xl">
<Kbd keys={["alt"]} listenToKeyboard />
<Kbd keys={["enter"]} listenToKeyboard />
<Kbd keys={["space"]} listenToKeyboard />
<Kbd keys={["ctrl", "J"]} listenToKeyboard />
<Kbd keys={[{ display: "Hold", key: "m" }]} listenToKeyboard />
<Kbd keys={["up"]} listenToKeyboard />
</div>
</div>
);
}
export default { KeyboardShortcutsDemo };