Licence
MIT
Version
1.0.4
Deps
4
Size
3.4 MB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated
the-keyboard
Keyboard component
Installation
$ npm install the-keyboard --save
Usage
'use strict'
import React from 'react'
import { TheKeyboard, TheKeyboardStyle } from 'the-keyboard'
class ExampleComponent extends React.Component {
constructor (props) {
super(props)
this.state = {
pressed: []
}
}
handleKeyPress = (key) => {
this.setState({
pressed: [...this.state.pressed, key]
})
}
render () {
return (
<div>
<TheKeyboardStyle/>
<div>{this.state.pressed.join('')}</div>
<TheKeyboard keys={[
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[null, 0, null],
]}
onKeyPress={this.handleKeyPress}
/>
</div>
)
}
}
export default ExampleComponent
Components
TheKeyboard
Keyboard component
Props
| Name | Type | Description | Default |
|---|---|---|---|
keys |
arrayOf array | Keys to show | `[ |
| [1, 2, 3], | |||
| [4, 5, 6], | |||
| [7, 8, 9], | |||
| [null, 0, null], | |||
| ]` | |||
onKeyPress |
func | Handle key press | () => null |
TheKeyboardButton
TheKeyboardStyle
Style for TheKeyboard
Props
| Name | Type | Description | Default |
|---|---|---|---|
options |
object | Style options | {} |
License
This software is released under the MIT License.