A small field of keys, like a keyboard seen up close, with a glyph raised out of it. A soft pillow lens follows the cursor and bulges the keys under it. Click and the keys flip, one after another, to the next glyph. It's drawn on one canvas and only runs while something moves.
npx shadcn@latest add https://clickworks.dev/r/keycap-matrix.jsonThe files land in components/clickworks/keycap-matrix/. No other packages are added.
import { KeycapMatrix } from "@/components/clickworks/keycap-matrix/react/KeycapMatrix"
export function Hero() {
return <KeycapMatrix glyph="Sparkle" style={{ width: 360, height: 360 }} />
}The sign the keys start on: Sparkle, Heart, Star, Bolt, Arrow, Check, Moon and 17 more.
Default "Smile"
Auto follows the page (its background, data-theme or dark class), then the device.
Default "auto"
Key and glyph colours for each theme.
The shadow under every key.
Default "#000000", 1
How much the lens lifts the keys under it.
Default 0.13
The lens follows the cursor.
Default true
A click moves on to the next glyph.
Default true
Keys flip one after another when the glyph changes.
Default true
It fills its frame and stays square. Colours come in through the light and dark props.