Docs
Button
Mechanical Key

Mechanical Key

A single mechanical keycap with press animation and sound.

by Sarthak Kapila

Installation


Usage


Mechanical Key Example

1import SingleKey from "@/components/mech-key";
2
3export default function Example() {
4 return <SingleKey keyLabel="" keyValue="Meta" />
5}

Understanding the component


The component renders a 3D-styled key that can be pressed by mouse or keyboard. It plays a click sound and simulates down/up travel with CSS transforms.

Props


PropTypeDefaultDescription
keyLabelstring"⌘"Visible label on the keycap.
keyValuestring"Meta"Keyboard key to listen to for press events.