Skip to content

    Browse components

    Keyboard

    A realistic compact keyboard whose keycaps sink and glow with backlight when you press the matching physical keys or click them, with a live typing strip and caps-lock LED.

    Open
    Customize

    graphite
    silver

    Installation

    npx shadcn@latest add @glint-ui/keyboard

    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/keyboard.json

    Usage

    import { Keyboard } from "@/components/ui/keyboard";
    
    <Keyboard accent="#c6ff3d" onKey={(code) => console.log(code)} />

    Props

    PropTypeDefaultDescription
    sizenumber40Key unit in px (board is 15 units wide).
    accentstring"#c6ff3d"Backlight color of pressed keys.
    variant"graphite" | "silver""graphite"Keycap and plate finish.
    showDisplaybooleantrueShow the typed-text strip.
    globalbooleanfalseListen to the whole window, not just while focused.
    onKeyReactNode—`(code: string) => void` for every press, with the KeyboardEvent.code.
    classNamestring—Extra classes for the root element.