1.0.2 • Published 5 months ago

react-thaana-input v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

React Thaana Input

A React hook for handling Thaana (Divehi) input seamlessly.

Installation

Install the package via npm:

npm install react-thaana-input

Usage

Text Input Example

import React from "react";
import useThaanaInput from "react-thaana-input";

const MyComponent = () => {
  const { value, handleKeyDown, handleInputChange } = useThaanaInput();

  return (
    <input
      type="text"
      value={value}
      onKeyDown={handleKeyDown}
      onChange={handleInputChange}
      placeholder="Type in Dhivehi"
    />
  );
};

export default MyComponent;

Textarea Example

const TextAreaExample = () => {
  const { value, handleKeyDown, handleInputChange } = useThaanaInput();

  return (
    <textarea
      value={value}
      onKeyDown={handleKeyDown}
      onChange={handleInputChange}
      placeholder="Type in Dhivehi"
    />
  );
};

export default TextAreaExample;

ContentEditable Example

const EditableDivExample = () => {
  const { value, handleKeyDown, handleSelect } = useThaanaInput();

  return (
    <div
      contentEditable
      onKeyDown={handleKeyDown}
      onSelect={handleSelect}
      suppressContentEditableWarning
      style={{
        border: "1px solid #ccc",
        padding: "8px",
        minHeight: "50px",
        width: "100%",
      }}
    >
      {value}
    </div>
  );
};

export default EditableDivExample;

Features

  • Supports thaana (Divehi) character input.
  • Compatible with React 16.8+, 17.x, and 18.x.
  • Works with input, textarea, and contentEditable elements.

Contributing

Feel free to fork and submit pull requests. Contributions are welcome!

License

MIT

Author

@fathihfaiz | @continumm.mv

1.0.2

5 months ago

1.0.1

6 months ago

1.0.0

9 months ago