JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q16692F
  • License MIT

Speech to text commponent for reactjs

Package Exports

  • react-stt
  • react-stt/dist/index.es.js
  • react-stt/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-stt) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

React-STT

This package lets you convert speech to text in a react app.


Instalation


 npm i react-stt

Attributes

Name
Description
exportText Returns the converted text.
startMessage Start Message. Start by default
stopMessage Stop Message. Stop by default

Example

Given below is a simple unstyled example that converts the speech and fills the input field.


import { useEffect, useState } from "react";
import SpeechTotext from "react-stt";

function App() {
  const [message, setMessage] = useState(null);

  useEffect(() => {
    //Scrolls to the bottom of the div tag.
    document.getElementById("message-box").value = message;
    const div = document.getElementById("message-box");
    div.scrollTop = div.scrollHeight - div.clientHeight;
  }, [message]);

  return (
    <>
      <SpeechTotext
        exportText={(note) => setMessage(note)}
        startMessage={"start"}
        stopMessage={"stop"}
      />

      <textarea id="message-box" cols="30" rows="10"></textarea>
    </>
  );
}

export default App;