A tiny library to display a reactive macbook keyboard on screen.
- vanilla, no framework required
- no dependency
- dark/light theme
- i18n friendly
// create an instance by invoking the factory method
const kbd = MacbookKeyboard({ theme: 'dark' });
// toggle the pressed status of key 'Shift'
kbd.toggle('Shift');
// get the pressed status of key 'Shift'
kbd.check('Shift');
// reset pressed status for all keys
kbd.clear();
{
// "dark", "light"
"theme": "dark",
// display label on each key
"showLabel": true,
// map key settings
"keyMappings": {
"Enter": {
"label": ["enter", "回车"],
},
},
}
This project is inspired by react-mac-keyboard.
MIT