react-wanakana

0.1.2 • Public • Published

WanaKanaReact

npm package

React wrapper for WanaKana.js

Example demo

https://wanakanareact.netlify.com

To do

  • Add ability to use a custom component

Different options

// default - romaji to kana
<WanakanaInput value="konnnichiwa" />
 
// kana to romaji
<WanakanaInput to="romaji" value="こんにちわ" />
 
// romaji to hiragana
<WanakanaInput to="hiragana" value="konnnichiwa" />
 
// romaji to katakana
<WanakanaInput to="katakana" value="TABERU" />

Useful props

Name Value
to kana (default), romaji, hiragana, katakana
component any valid dom element (input, textarea, etc)

To use in a form

import WanakanaInput from 'react-wanakana';
 
const WanakanaInput = () => {
  const [greeting, setGreeting] = useState('こんにちわ');
  const handleChange = e => {
    setGreeting(e.target.value);
  };
 
  return (
    <form
      onSubmit={(e, values) => {
        e.preventDefault();
        alert(greeting);
      }}
    >
      <WanakanaInput name="greeting" value={greeting} onChange={handleChange} />
      <button type="submit">Submit</button>
    </form>
  );
};

To develop in storybook

npm run storybook

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.23latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.23
0.1.11
0.1.01
0.0.11

Package Sidebar

Install

npm i react-wanakana

Weekly Downloads

6

Version

0.1.2

License

MIT

Unpacked Size

15 kB

Total Files

10

Last publish

Collaborators

  • tylerwolff