Kewti

Docs

Components

Kewti Input

A multilingual input component with Amharic transliteration, spell checking, voice dictation, and controlled/uncontrolled support.

const InputExample = () => {
const [text, setText] = useState("");

return (
  <KewtiInput 
    className="w-full" 
    variant="input" 
    placeholder="Type in Amharic or English..." 
    value={text}
    spellCheck={true}
    showVoiceInput={true}
    onChange={(e) => setText(e.target.value)}
  />
);
};
render(<InputExample />);

Installation

npx kewti-cli add input

Usage

import { KewtiInput } from "@/kewti/ui"

Basic Input

<KewtiInput
  placeholder="Type a message..."
  onSend={(value) => console.log(value)}
/>

Spell Check

Enable real-time Amharic spell checking with inline error highlighting and word correction suggestions.

<KewtiInput
  spellCheck
  placeholder="ጽሑፍ ያስገቡ..."
/>

Textarea

<KewtiInput
  variant="textarea"
  placeholder="Write something..."
  onSend={(value) => console.log(value)}
/>

Controlled Component

const [message, setMessage] = useState("")

<KewtiInput
  value={message}
  onValueChange={setMessage}
/>

Amharic by Default

<KewtiInput /> // Amharic Input by default
// For English by default:
<KewtiInput defaultLanguage="en" />

Disable the Input

<KewtiInput disabled />

Hide VoiceInput

<KewtiInput showVoiceInput={false} />

Features

  • Toggle between Amharic and English input.
  • Real-time Amharic transliteration from Latin characters.
  • Multiple transliteration suggestions and homophone support.
  • Built-in Amharic spell checking via KewtiSpell.
  • Built-in voice dictation.
  • Supports both input and textarea variants.
  • Auto-resizing textarea.
  • Controlled and uncontrolled modes.
  • Compatible with React Hook Form and other form libraries.
  • Keyboard shortcuts for fast typing.

How to Write (Amharic Transliteration)

When Amharic mode is active, Latin keystrokes are automatically converted into Ge'ez script (Fidel).

1. Vowel Order Modifications

Type a consonant key followed by a vowel to change the Fidel order:

Fidel OrderModifying KeyExample (b + Key)Output
1st Order (G'eez)(Default / Consonant only)bበ
2nd Order (Ka'ib)ub + uቡ
3rd Order (Salis)ib + iቢ
4th Order (Rabi)ab + aባ
5th Order (Hamis)ieb + i + eቤ
6th Order (Sadis)eb + eብ
7th Order (Sabi)ob + oቦ

2. Consonant Mappings

KeyPrimaryAlternative Suggestions
bበ—
cሰጨ, ቸ, ከ
dደ—
fፈ—
gገጀ
hሀሐ, ኅ, ኸ
jጀ—
kከቀ
lለ—
mመ—
nነኘ
pፐጰ
qቀ—
rረ—
sሸሰ, ሠ
tተጠ, ፀ, ጸ
vቨ—
wወ—
xአዐ, ዠ
yየ—
zዘዠ

3. Punctuation Mappings

KeyAmharic PunctuationName
.።Arat Neteb (Full Stop)
,፣Comma
;፤Semicolon
:፥Hulet Neteb (Colon)

4. Homophones & Phonetic Variants

Some letters in Amharic share identical or similar pronunciations. When typing these characters, KewtiInput automatically presents alternative homophones in the suggestion menu:

  • Ha variants: ሀ ↔ ሐ ↔ ኅ
  • Se variants: ሰ ↔ ሠ
  • Tse variants: ጸ ↔ ፀ
  • A variants: አ ↔ ዐ

Keyboard Shortcuts

ShortcutAction
SpaceAccept the selected transliteration
← → ↑ ↓Navigate transliteration suggestions
EnterAccept suggestion (when suggestions are visible)
EnterSend message (when no suggestions are visible)
Shift + EnterInsert a new line (textarea only)

Voice Dictation

Click the microphone icon to start dictation.

  • Uses the browser's Speech Recognition API.
  • Dictation language is Amharic (am-ET).
  • Speech is appended to the existing input.
  • Recording can be stopped at any time.

If speech recognition isn't supported by the browser, the microphone button is automatically hidden.


Props

PropTypeDefaultDescription
variant"input" | "textarea""input"Input variant to render.
valuestring—Controlled value.
onValueChange(value: string) => void—Called whenever the value changes. Recommended for controlled state.
onChangeChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>—Standard React change event.
onSend(value: string) => void—Called when Enter is pressed (or Enter without Shift in textarea).
defaultLanguage"am" | "en""am"Initial input language.
placeholderstring—Placeholder text.
spellCheckbooleanfalseWhen true, enables Amharic spell checking via KewtiSpell.
showVoiceInputbooleanfalseShows or hides the voice input button.
disabledbooleanfalseDisables editing, language switching, and voice input.
classNamestring—Additional classes for the outer container.
inputClassNamestring—Additional classes for the input or textarea.
styleReact.CSSProperties—Inline styles for the container.
onKeyDownKeyboardEventHandler—Custom keyboard event handler.

All standard HTML input or textarea props are also supported.


Browser Support

Voice dictation relies on the browser's Speech Recognition API (SpeechRecognition or webkitSpeechRecognition).

Supported browsers include:

  • Chrome
  • Microsoft Edge
  • Other Chromium-based browsers

Browsers without speech recognition support automatically hide the microphone button.

On this page