react-voice-input
Voice input component for React.JS
Installation
$ npm install react-voice-input
Usage
Component { superprops thisstate = inputText: '' thisonResult = thisonResult thisonInputChange = thisonInputChange } { this } { this } { const onEnd = { console } return <main> <ReactVoiceInput onResult=thisonResult onEnd=onEnd > <input type='text' value=inputText onChange=thisonInputChange /> </ReactVoiceInput> </main> }
API
onSpeechStart()
- optional callback function to detect speech startonResult(value)
- callback function when get value from speechonEnd()
- optional callback function when the speech endonError(event)
- optional callback function when there's an errorcontainerClassName
- optional, the class name apply to the container, default torvi-contianer
microphoneClassName
- optional, the class name apply to microphone, default torvi-microphone
microphoneStyle
- optional inline style for the button
For how to use it, check the example
folder.
Run example
$ cd example$ yarn$ yarn run dev
Then go to http://localhost:3000/ in browser.
License
MIT