Fork Notice: This is a modernized fork of v-money by Marcos Neves. The original project was created for Vue 2, and this fork brings it up to modern standards with Vue 3, TypeScript, and contemporary tooling.
Modern Vue 3 currency input component and directive with TypeScript support. A complete rewrite of v-money for Vue 3 with modern tooling and best practices.
π Live Demo
Try the interactive demo to see all features in action!
- Original Author: Marcos Neves - v-money
- Original Demo: vuejs-tips.github.io/v-money
- Fork Maintainer: Assoft
- π Vue 3 Compatible - Built for Vue 3 with Composition API
- π¦ TypeScript Support - Full type safety and IntelliSense
- π― Lightweight - <2KB gzipped
- π§ Dependency Free - No external dependencies
- π± Mobile Support - Touch-friendly
- π¨ Component & Directive - Use as component or directive
- π Copy/Paste Support - Handles clipboard operations
- βοΈ Editable - Full editing capabilities
- π§ͺ Well Tested - Comprehensive test coverage
npm install vue-currency # or yarn add vue-currency # or pnpm add vue-currencyimport { createApp } from 'vue' import VueCurrency from 'vue-currency' const app = createApp({}) app.use(VueCurrency, { precision: 4, decimal: '.', thousands: ',', prefix: '$ ', suffix: '', masked: false })<template> <div> <VMoney v-model="price" v-bind="moneyConfig" /> <p>Value: {{ price }}</p> </div> </template> <script setup lang="ts"> import { ref } from 'vue' import { VMoney } from 'v-money-v2' const price = ref(123.45) const moneyConfig = { decimal: ',', thousands: '.', prefix: 'R$ ', suffix: ' #', precision: 2, masked: false } </script><template> <div> <input v-model.lazy="price" v-money="moneyConfig" /> <p>Value: {{ price }}</p> </div> </template> <script setup lang="ts"> import { ref } from 'vue' import { VMoneyDirective } from 'v-money-v2' const price = ref(123.45) const moneyConfig = { decimal: ',', thousands: '.', prefix: 'R$ ', suffix: ' #', precision: 2 } </script>| Property | Type | Default | Description |
|---|---|---|---|
| precision | number | 2 | Number of decimal places |
| decimal | string | "." | Decimal separator |
| thousands | string | "," | Thousands separator |
| prefix | string | "" | Currency symbol prefix (e.g., "R$ ") |
| suffix | string | "" | Currency symbol suffix (e.g., " %") |
| masked | boolean | false | Whether to include mask in component output |
import type { MoneyConfig } from 'v-money-v2' const config: MoneyConfig = { precision: 2, decimal: '.', thousands: ',', prefix: '$ ', suffix: '', masked: false }# Install dependencies npm install # Start development server npm run dev # Build for production npm run build # Run tests npm run test # Run linting npm run lint # Format code npm run formatThis fork is a complete rewrite of the original v-money for Vue 3. Key improvements:
- β Vue 3 Support - Full Vue 3 Composition API compatibility
- β TypeScript - Complete type safety and IntelliSense
- β Modern Tooling - Vite, Vitest, ESLint, Prettier
- β Better Performance - Optimized for Vue 3 reactivity
- β Event Handling - Enhanced event system (focus, blur, keydown, paste)
- β Style Agnostic - No default styles, full customization freedom
- β Comprehensive Tests - 40+ test cases with 100% coverage
- Package name:
v-moneyβvue-currency - Import:
import VMoney from 'v-money'βimport VueCurrency from 'vue-currency' - Vue 3 only (Vue 2 not supported)
- TypeScript-first approach
MIT
