Component
Money input
<DomMoneyInput>A field-compatible decimal input with currency chrome for prices, budgets, invoices, and payouts.
Playground
Try every prop live
Money input playground
Use the currency chrome for display, then transform the decimal value in your form or backend layer.
/ mo
Playground.vuevue
<script setup>
import { reactive } from 'vue';
import { DomMoneyInput } from '@getdom/studio/vue';
const data = reactive({
"modelValue": "149.00",
"id": "",
"name": "",
"label": "Price",
"description": "",
"placeholder": "",
"required": false,
"disabled": false,
"readOnly": false,
"invalid": false,
"errors": [],
"visible": true,
"validators": [],
"validateOnBlur": true,
"chrome": "field",
"currency": "GBP",
"locale": "en-GB",
"prefix": "",
"suffix": "/ mo",
"min": null,
"max": null,
"step": 0.01,
"textAlign": "right"
});
</script>
<template>
<DomMoneyInput
v-bind="data"
@update:modelValue="data.modelValue = $event"
/>
</template>Demo
Invoice amount
Keep calculations in the parent so currency parsing and billing policy stay application-owned.
Stored as a decimal string.
Preview total
£1788.00 / month
<script setup>
import { computed, ref } from 'vue';
import { DomMoneyInput } from '../../../lib/vue';
const amount = ref('149.00');
const seats = ref('12');
const monthlyTotal = computed(() => {
const price = Number(amount.value);
const quantity = Number(seats.value);
if (!Number.isFinite(price) || !Number.isFinite(quantity)) return '0.00';
return (price * quantity).toFixed(2);
});
</script>
<template>
<div class="w-full max-w-xl rounded-lg border border-border bg-canvas p-5 shadow-sm">
<div class="grid gap-4 sm:grid-cols-2">
<DomMoneyInput
v-model="amount"
label="Seat price"
description="Stored as a decimal string."
currency="GBP"
/>
<label class="grid gap-1 text-sm">
<span class="font-medium text-canvas-fg">Seats</span>
<input v-model="seats" class="skin-input h-10" inputmode="numeric" />
</label>
</div>
<div class="mt-5 rounded-md border border-border bg-secondary/40 p-4">
<p class="text-xs font-semibold uppercase text-muted-fg">Preview total</p>
<p class="mt-1 text-2xl font-semibold tracking-tight text-canvas-fg">£{{ monthlyTotal }} / month</p>
</div>
</div>
</template>
Reference
Props
Control props
| Name | Type | TS | Default | Description |
|---|---|---|---|---|
modelValue | string | number | string | '' | Current decimal amount. |
currency | string | string | 'GBP' | ISO currency code used for the visual prefix. |
locale | string | string | 'en-GB' | Locale used to resolve the currency symbol. |
prefix | string | string | '' | Prefix override. Defaults to the currency symbol. |
suffix | string | string | '' | Optional suffix such as per month. |
min | number | number | — | Minimum numeric value. |
max | number | number | — | Maximum numeric value. |
step | number | number | 0.01 | Native numeric step hint. |
textAlign | 'left' | 'right' | string | 'right' | Input text alignment. |
Field props
| Name | Type | TS | Default | Description |
|---|---|---|---|---|
id | string | string | '' | Optional ID override. By default parent forms derive the input ID from the field path using underscores. |
name | string | string | '' | Local field name. Parent forms derive the full field path and native HTML name from the form hierarchy. |
label | string | string | '' | Visible field label. |
description | string | string | '' | Optional helper copy below the field. |
placeholder | string | string | '' | Placeholder shown when the control is empty. |
required | boolean | boolean | false | Mark the field as required. |
disabled | boolean | boolean | false | Disable field interaction. |
readOnly | boolean | boolean | false | Show the value but prevent editing. |
invalid | boolean | boolean | false | Mark the field invalid. |
errors | array | object | string | Array< | [] | Validation errors for this field. |
visible | boolean | boolean | true | Show or hide the field. |
validators | array | Array<unknown> | [] | Validators attached to this field. Use functions in Vue code, or serializable records such as { name: "minLength", props: { min: 2 } } in generated schemas. |
validateOnBlur | boolean | boolean | true | Run validators when the field loses focus. |
chrome | 'field' | false | string | 'field' | Render default field chrome, or false to render only the control while keeping form state wiring. |
Auto-generated from Money input.props and inline _edit hints.
Events
| Name | Payload | Description |
|---|---|---|
| @update:modelValue | string | number | Fired when the amount changes. |
| @focus | FocusEvent | Fired when the input receives focus. |
| @blur | FocusEvent | Fired when the input loses focus. |
Names auto-detected from defineEmits and source emit() calls; payload and description from __doc.events when present.