Mechanical keycaps that type out words with springy presses
| Name | Type | Default | Description |
|---|---|---|---|
text | string | "SHIP IT" | Text spelled out as keys. Spaces become a wide space bar. |
accentKey | string | "↵" | Extra key appended in the accent colour. Use an empty string for none. |
keys | (string | KeycapKey)[] | — | Exact keys instead of text. A key is a label or { label, width?, accent?, match? }. width is in key units, match is the keyboard key it answers to. |
mode | "type" | "wave" | "combo" | "type" | Type presses the keys in order like someone typing. Wave rolls a press across the row. Combo holds every key in turn, then the last one, like a shortcut. |
size | number | 72 | Width of a one-unit key in pixels. Keys shrink, then wrap onto rows, in narrow containers. |
gap | number | 8 | Space between keys in pixels. |
radius | number | 10 | Corner radius of a key at full size. The plate's corners stay concentric. |
travel | number | 5 | How far a key moves when pressed, in pixels at full size. |
profile | "sculpted" | "flat" | "sculpted" | Sculpted keys are tall with a dished top. Flat keys are low profile, like a laptop keyboard. |
legend | "center" | "corner" | "center" | Where the label sits on each key. |
plate | boolean | true | Seats the keys in an aluminium plate. Off floats them on the page. |
speed | number | 1 | Speed of the typing, wave or combo. |
pause | number | 1400 | Milliseconds between loops. |
autoplay | boolean | true | Plays the mode on its own while the keys are in view. Pauses while the pointer is over them. |
keyboard | boolean | true | While the pointer is over the keys, or they have focus, pressing a matching key on your keyboard presses it here too. |
sound | boolean | false | Plays a soft mechanical click on each press, after the visitor first interacts. |
intro | boolean | true | Drops the keys onto their switches one by one the first time they scroll into view. Off, or with reduced motion, it starts settled. |
theme | "auto" | "light" | "dark" | "auto" | Auto picks light or dark keys from the background behind them. |
keyColor | string | from theme | Keycap colour. Shading and sides are mixed from it. |
legendColor | string | from theme | Colour of the labels. |
accentColor | string | theme violet | Colour of accent keys. |
ref | { press, play, pause } | — | press(index) taps a key from your own code, for example in time with a product demo. |
className | string | — | Classes for the root element. |
style | CSSProperties | — | Inline styles for the root element. |
textstringText spelled out as keys. Spaces become a wide space bar.
"SHIP IT"accentKeystringExtra key appended in the accent colour. Use an empty string for none.
"↵"keys(string | KeycapKey)[]Exact keys instead of text. A key is a label or { label, width?, accent?, match? }. width is in key units, match is the keyboard key it answers to.
—mode"type" | "wave" | "combo"Type presses the keys in order like someone typing. Wave rolls a press across the row. Combo holds every key in turn, then the last one, like a shortcut.
"type"sizenumberWidth of a one-unit key in pixels. Keys shrink, then wrap onto rows, in narrow containers.
72gapnumberSpace between keys in pixels.
8radiusnumberCorner radius of a key at full size. The plate's corners stay concentric.
10travelnumberHow far a key moves when pressed, in pixels at full size.
5profile"sculpted" | "flat"Sculpted keys are tall with a dished top. Flat keys are low profile, like a laptop keyboard.
"sculpted"legend"center" | "corner"Where the label sits on each key.
"center"platebooleanSeats the keys in an aluminium plate. Off floats them on the page.
truespeednumberSpeed of the typing, wave or combo.
1pausenumberMilliseconds between loops.
1400autoplaybooleanPlays the mode on its own while the keys are in view. Pauses while the pointer is over them.
truekeyboardbooleanWhile the pointer is over the keys, or they have focus, pressing a matching key on your keyboard presses it here too.
truesoundbooleanPlays a soft mechanical click on each press, after the visitor first interacts.
falseintrobooleanDrops the keys onto their switches one by one the first time they scroll into view. Off, or with reduced motion, it starts settled.
truetheme"auto" | "light" | "dark"Auto picks light or dark keys from the background behind them.
"auto"keyColorstringKeycap colour. Shading and sides are mixed from it.
from themelegendColorstringColour of the labels.
from themeaccentColorstringColour of accent keys.
theme violetref{ press, play, pause }press(index) taps a key from your own code, for example in time with a product demo.
—classNamestringClasses for the root element.
—styleCSSPropertiesInline styles for the root element.
—