
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
dhivehi-input
Advanced tools
Modern Dhivehi/Thaana input system for JavaScript and Vue.js applications
A modern, lightweight JavaScript library for enabling Dhivehi/Thaana text input in web applications. Automatically converts English keyboard input to Dhivehi characters in real-time.
dhivehi-input class to any input elementnpm install dhivehi-input
Or with yarn:
yarn add dhivehi-input
Or use via CDN:
<script src="https://unpkg.com/dhivehi-input/lib/standalone.umd.min.js"></script>
The simplest way to add Dhivehi input to any element:
<input type="text" class="dhivehi-input" placeholder="ލިޔުއްވާ">
That's it! The input will automatically convert English typing to Dhivehi characters.
<input type="text" class="dhivehi-input" data-dhivehi-keyboard="phonetic-hh">
<input type="text" class="dhivehi-input" data-dhivehi-keyboard="typewriter">
import DhivehiInput from 'dhivehi-input';
// Create instance
const dhivehi = new DhivehiInput({
keyboard: 'phonetic',
className: 'my-dhivehi-input'
});
// Setup specific element
dhivehi.setupElement(document.getElementById('my-input'));
import { createApp } from 'vue';
import DhivehiInputPlugin from 'dhivehi-input/vue';
const app = createApp({});
app.use(DhivehiInputPlugin);
<template>
<!-- Simple usage -->
<input v-dhivehi-input type="text">
<!-- With custom keyboard -->
<input v-dhivehi-input="'phonetic-hh'" type="text">
<!-- With options -->
<input v-dhivehi-input="{ keyboard: 'typewriter', enabled: true }" type="text">
</template>
<script setup>
import { useDhivehiInput } from 'dhivehi-input/vue';
const { translateChar, setupElement, keyboards } = useDhivehiInput();
// Translate individual characters
const dhivehiChar = translateChar('a'); // Returns 'އ'
// Get available keyboards
console.log(Object.keys(keyboards.value)); // ['phonetic', 'phonetic-hh', 'typewriter']
</script>
phonetica → އ, s → ސ, d → ދphonetic-hhtypewriterimport { translateChar, insertTextAtCursor, DhivehiInput } from 'dhivehi-input';
// Translate single character
const translated = translateChar('a', 'phonetic'); // 'އ'
// Insert text at cursor
insertTextAtCursor(inputElement, 'ޖޮއްލާ');
// Create instance
const dhivehi = new DhivehiInput(options);
const config = {
keyboard: 'phonetic', // Default keyboard layout
className: 'dhivehi-input', // CSS class to detect
activeClassName: 'dhivehi-input-active', // Applied to active elements
enableRtl: true, // Enable RTL styling
autoInit: true // Auto-initialize on creation
};
const dhivehi = new DhivehiInput();
// Setup/remove elements
dhivehi.setupElement(element);
dhivehi.removeElement(element);
// Control observation
dhivehi.startObserver();
dhivehi.stopObserver();
// Keyboard management
dhivehi.setKeyboard(element, 'phonetic-hh');
dhivehi.getKeyboards(); // ['phonetic', 'phonetic-hh', 'typewriter']
// Cleanup
dhivehi.destroy();
The library automatically applies appropriate RTL styling. You can customize the appearance:
.dhivehi-input {
font-family: 'MV Boli', 'Faruma', Thaana, Arabic, sans-serif;
direction: rtl;
text-align: right;
}
.dhivehi-input-active:focus {
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
border-color: #3b82f6;
}
Works with:
<input type="text"><input type="search"><input type="url"><input type="tel"><input type="password"><textarea>contenteditable="true"// Different configurations for different sections
const adminDhivehi = new DhivehiInput({
className: 'admin-dhivehi',
keyboard: 'typewriter'
});
const userDhivehi = new DhivehiInput({
className: 'user-dhivehi',
keyboard: 'phonetic'
});
// Listen for Dhivehi input events
document.addEventListener('dhivehi:input', (event) => {
console.log(`Typed: ${event.detail.originalChar} → ${event.detail.translatedChar}`);
});
// Listen for setup events
document.addEventListener('dhivehi:setup', (event) => {
console.log(`Element setup with keyboard: ${event.detail.keyboard}`);
});
const dhivehi = new DhivehiInput();
// Switch keyboard for specific element
dhivehi.setKeyboard(inputElement, 'phonetic-hh');
// Or via data attribute
inputElement.dataset.dhivehiKeyboard = 'typewriter';
# Clone the repository
git clone https://github.com/yourusername/dhivehi-input.git
cd dhivehi-input
# Install dependencies
npm install
# Build the library
npm run build
# Build and watch for changes
npm run dev
# Format code
npm run format
# Lint code
npm run lint
Check out the examples/ directory for complete implementation examples:
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
If you have any questions or need help integrating this library, please:
Made with ❤️ for the Maldivian developer community
FAQs
Modern Dhivehi/Thaana input system for JavaScript and Vue.js applications
The npm package dhivehi-input receives a total of 4 weekly downloads. As such, dhivehi-input popularity was classified as not popular.
We found that dhivehi-input demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.