Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.
MoneyField
The MoneyField component provides a specialized numeric input for monetary values. It accepts a currency code, minimum and maximum constraints, and returns values as either a number or a Money object.
For plain numeric input without currency handling, use NumberField.
Supported targets
- admin.
abandoned-checkout-details. action. render - admin.
abandoned-checkout-details. block. render - admin.
catalog-details. action. render - admin.
catalog-details. block. render - admin.
collection-details. action. render - admin.
collection-details. block. render - admin.
collection-index. action. render - admin.
company-details. action. render - admin.
company-details. block. render - admin.
company-location-details. block. render - admin.
customer-details. action. render - admin.
customer-details. block. render - admin.
customer-index. action. render - admin.
customer-index. selection-action. render - admin.
customer-segment-details. action. render - admin.
discount-details. action. render - admin.
discount-details. function-settings. render - admin.
discount-index. action. render - admin.
draft-order-details. action. render - admin.
draft-order-details. block. render - admin.
draft-order-index. action. render - admin.
draft-order-index. selection-action. render - admin.
gift-card-details. action. render - admin.
gift-card-details. block. render - admin.
order-details. action. render - admin.
order-details. block. render - admin.
order-details. print-action. render - admin.
order-fulfilled-card. action. render - admin.
order-index. action. render - admin.
order-index. selection-action. render - admin.
order-index. selection-print-action. render - admin.
product-details. action. render - admin.
product-details. block. render - admin.
product-details. configuration. render - admin.
product-details. print-action. render - admin.
product-details. reorder. render - admin.
product-index. action. render - admin.
product-index. selection-action. render - admin.
product-index. selection-print-action. render - admin.
product-purchase-option. action. render - admin.
product-variant-details. action. render - admin.
product-variant-details. block. render - admin.
product-variant-details. configuration. render - admin.
product-variant-purchase-option. action. render - admin.
settings. order-routing-rule. render - admin.
settings. validation. render
Supported targets
- admin.
abandoned-checkout-details. action. render - admin.
abandoned-checkout-details. block. render - admin.
catalog-details. action. render - admin.
catalog-details. block. render - admin.
collection-details. action. render - admin.
collection-details. block. render - admin.
collection-index. action. render - admin.
company-details. action. render - admin.
company-details. block. render - admin.
company-location-details. block. render - admin.
customer-details. action. render - admin.
customer-details. block. render - admin.
customer-index. action. render - admin.
customer-index. selection-action. render - admin.
customer-segment-details. action. render - admin.
discount-details. action. render - admin.
discount-details. function-settings. render - admin.
discount-index. action. render - admin.
draft-order-details. action. render - admin.
draft-order-details. block. render - admin.
draft-order-index. action. render - admin.
draft-order-index. selection-action. render - admin.
gift-card-details. action. render - admin.
gift-card-details. block. render - admin.
order-details. action. render - admin.
order-details. block. render - admin.
order-details. print-action. render - admin.
order-fulfilled-card. action. render - admin.
order-index. action. render - admin.
order-index. selection-action. render - admin.
order-index. selection-print-action. render - admin.
product-details. action. render - admin.
product-details. block. render - admin.
product-details. configuration. render - admin.
product-details. print-action. render - admin.
product-details. reorder. render - admin.
product-index. action. render - admin.
product-index. selection-action. render - admin.
product-index. selection-print-action. render - admin.
product-purchase-option. action. render - admin.
product-variant-details. action. render - admin.
product-variant-details. block. render - admin.
product-variant-details. configuration. render - admin.
product-variant-purchase-option. action. render - admin.
settings. order-routing-rule. render - admin.
settings. validation. render
Anchor to PropertiesProperties
Props for the MoneyField component, a specialized input for entering monetary values. It extends standard input props with number constraints and autocomplete support for transaction amounts.
- Anchor to labellabellabelstringstringrequiredrequired
The text content to display as the field's label. This label is always required for accessibility as it tells users what information the field expects. The label is rendered visually above the field.
- Anchor to autocompleteautocompleteautocomplete| AutocompleteField | `${AutocompleteSection} ${AutocompleteField}` | `${AutocompleteGroup} ${AutocompleteField}` | `${AutocompleteSection} ${AutocompleteGroup} ${AutocompleteField}` | boolean| AutocompleteField | `${AutocompleteSection} ${AutocompleteField}` | `${AutocompleteGroup} ${AutocompleteField}` | `${AutocompleteSection} ${AutocompleteGroup} ${AutocompleteField}` | boolean
A hint to the browser about the expected content of the field, used to offer autofill suggestions.
true: The field supports autofill, but no specific content type is specified.false: The field contains sensitive or ephemeral data that should not be autofilled, such as one-time codes.- An
token (such as'email'or'street-address'): Tells the browser exactly what data to suggest for this field.
Learn more about the supported autocomplete values.
- Anchor to currencyCodecurrencyCodecurrencyCodeCurrencyCodeCurrencyCode
The ISO 4217 currency code associated with the monetary value. This code is included in the
Moneyobject returned by. For example,for US Dollars orfor Euros.- Anchor to defaultValuedefaultValuedefaultValuestring | string[]string | string[]
The initial value of the field when it isn't controlled by state. Use this instead of
valuewhen you don't need to manage the field's state yourself. The component tracks its own value internally and reports changes through.- Anchor to disableddisableddisabledbooleanbooleanDefault: falseDefault: false
Whether the field is disabled. When
true, the field can't be edited by the user, won't receive focus, and won't be submitted with the form. Use this for fields that aren't relevant in the current context.- Anchor to errorerrorerrorstringstring
An error message to display below the field. When set, the field receives a specific stylistic treatment (typically a red border) to communicate problems that have to be resolved immediately. The string value is displayed as the error message.
Pass
undefinedor omit this prop to clear the error state.- Anchor to idididstringstring
A unique identifier for the field.
- Anchor to maxmaxmaxnumbernumber
The highest decimal or integer to be accepted for the field. When using the stepper buttons, the value won't exceed this limit. If
stepwould overshoot, then the value rounds down tomax. A user can still type a number higher thanmaxusing the keyboard, so add appropriate validation with theerrorprop.- Anchor to minminminnumbernumberDefault: 0Default: 0
The lowest decimal or integer to be accepted for the field. When using the stepper buttons, the value won't go below this limit. If
stepwould undershoot, then the value rounds up tomin. A user can still type a number lower thanminusing the keyboard, so add appropriate validation with theerrorprop.- Anchor to namenamenamestringstring
An identifier for the field that is unique within the nearest containing Form component.
- Anchor to onBluronBluronBlur() => void() => void
A callback fired when the field loses focus. This is useful for triggering validation after the user finishes interacting with the field, or for tracking which fields have been "touched" in a form.
- Anchor to onChangeonChangeonChange(value: number | Money) => void(value: number | Money) => void
A callback that fires when the user finishes editing the field, typically on blur. Only fires if the value changed. Update your state in this callback and pass the new value back through the
valueprop.This doesn't fire on every keystroke. Use
for real-time responses like clearing validation errors as the user types. Don't useto controlvaluebecause that can cause issues on lower-powered devices due to asynchronous rendering.- Anchor to onFocusonFocusonFocus() => void() => void
A callback fired when the field receives focus. This is useful for clearing errors, showing helper text, or tracking user interaction with form fields.
- Anchor to onInputonInputonInput(value: number | Money) => void(value: number | Money) => void
A callback that fires on every change the user makes in the field, including each keystroke. The callback receives the current value.
Use
for immediate responses like clearing validation errors as the user types. Don't use it to control the field'svalueprop. Usefor that instead.- Anchor to placeholderplaceholderplaceholderstringstring
A short hint displayed inside the field when it's empty. Use placeholder text to show an example of the expected value (such as "100" or "Search by name"). Don't use placeholder text as a substitute for the
labelas it disappears after the user starts typing.- Anchor to readOnlyreadOnlyreadOnlybooleanbooleanDefault: falseDefault: false
Whether the field is read-only. Unlike
disabled, a read-only field can still receive focus and its value is included when the form is submitted. Use this when the value should be visible and selectable but not editable, such as a computed total.- Anchor to requiredrequiredrequiredbooleanboolean
Whether the field needs a value. This requirement adds semantic value to the field, but it won't cause an error to appear automatically. If you want to present an error when this field is empty, you can do so with the
errorprop.- Anchor to stepstepstepnumbernumberDefault: 1Default: 1
The increment amount for the stepper buttons. This can be an integer or decimal (such as
0.01for cents). Each press of the stepper button increases or decreases the value by this amount. Ifmaxorminis set, the final value always rounds to the boundary rather than overshooting.- Anchor to valuevaluevalueTT
The current value for the field. If omitted, then the field will be empty. You should update this value in response to the
callback.
AutocompleteSection
A section prefix that scopes autofill data to a specific area of the page. Use this when the same page contains multiple groups of fields that share the same autocomplete tokens, such as two separate shipping address forms. The value must follow the pattern `section-${name}`, for example `"section-shipping-1"`.
`section-${string}`AutocompleteGroup
The contact information group the autocomplete data should be sourced from. - `shipping`: Autofill with the user's shipping address information. - `billing`: Autofill with the user's billing address information.
'shipping' | 'billing'CurrencyCode
The supported monetary currencies from [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html).
'USD' | 'EUR' | 'GBP' | 'CAD' | 'AFN' | 'ALL' | 'DZD' | 'AOA' | 'ARS' | 'AMD' | 'AWG' | 'AUD' | 'BBD' | 'AZN' | 'BDT' | 'BSD' | 'BHD' | 'BIF' | 'BZD' | 'BMD' | 'BTN' | 'BAM' | 'BRL' | 'BOB' | 'BWP' | 'BND' | 'BGN' | 'MMK' | 'KHR' | 'CVE' | 'KYD' | 'XAF' | 'CLP' | 'CNY' | 'COP' | 'KMF' | 'CDF' | 'CRC' | 'HRK' | 'CZK' | 'DKK' | 'DOP' | 'XCD' | 'EGP' | 'ETB' | 'XPF' | 'FJD' | 'GMD' | 'GHS' | 'GTQ' | 'GYD' | 'GEL' | 'HTG' | 'HNL' | 'HKD' | 'HUF' | 'ISK' | 'INR' | 'IDR' | 'ILS' | 'IQD' | 'JMD' | 'JPY' | 'JEP' | 'JOD' | 'KZT' | 'KES' | 'KWD' | 'KGS' | 'LAK' | 'LVL' | 'LBP' | 'LSL' | 'LRD' | 'LTL' | 'MGA' | 'MKD' | 'MOP' | 'MWK' | 'MVR' | 'MXN' | 'MYR' | 'MUR' | 'MDL' | 'MAD' | 'MNT' | 'MZN' | 'NAD' | 'NPR' | 'ANG' | 'NZD' | 'NIO' | 'NGN' | 'NOK' | 'OMR' | 'PAB' | 'PKR' | 'PGK' | 'PYG' | 'PEN' | 'PHP' | 'PLN' | 'QAR' | 'RON' | 'RUB' | 'RWF' | 'WST' | 'SAR' | 'RSD' | 'SCR' | 'SGD' | 'SDG' | 'SYP' | 'ZAR' | 'KRW' | 'SSP' | 'SBD' | 'LKR' | 'SRD' | 'SZL' | 'SEK' | 'CHF' | 'TWD' | 'THB' | 'TZS' | 'TTD' | 'TND' | 'TRY' | 'TMT' | 'UGX' | 'UAH' | 'AED' | 'UYU' | 'UZS' | 'VUV' | 'VND' | 'XOF' | 'YER' | 'ZMW' | 'BYN' | 'BYR' | 'DJF' | 'ERN' | 'FKP' | 'GIP' | 'GNF' | 'IRR' | 'KID' | 'LYD' | 'MRU' | 'SLL' | 'SHP' | 'SOS' | 'STD' | 'STN' | 'TJS' | 'TOP' | 'VED' | 'VEF' | 'VES' | 'XXX'Money
Represents a monetary value with an amount and currency code. Used as the value type for the MoneyField component.
- amount
The monetary amount as a decimal number, such as `29.99`.
number - currencyCode
The [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) currency code for the amount, such as `'USD'` or `'EUR'`.
CurrencyCode
Anchor to ExamplesExamples
Anchor to Set product cost priceSet product cost price
Set a cost-per-item price in USD and save it from an action modal. This example uses MoneyField with currencyCode set to USD, with a Button that saves the price and closes the modal.
Set product cost price
 that saves the price and closes the modal.](https://cdn.shopify.com/shopifycloud/shopify-dev/production/assets/assets/images/templated-apis-screenshots/admin-extensions/2025-07/moneyfield-default-C1uTBn37.png)
Set product cost price
React
import {useState} from 'react';
import {reactExtension, useApi, MoneyField, Button, BlockStack} from '@shopify/ui-extensions-react/admin';
function App() {
const {data, close} = useApi('admin.product-details.action.render');
const productId = data.selected[0]?.id;
const [cost, setCost] = useState(0);
return (
<BlockStack>
<MoneyField
label="Cost per item"
name="costPrice"
currencyCode="USD"
value={cost}
onChange={setCost}
/>
<Button
variant="primary"
onPress={async () => {
await fetch('/api/products/cost', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({productId, costPrice: cost}),
});
close();
}}
>
Save cost price
</Button>
</BlockStack>
);
}
export default reactExtension(
'admin.product-details.action.render',
() => <App />,
);TS
import {extension, MoneyField, Button, BlockStack} from '@shopify/ui-extensions/admin';
export default extension(
'admin.product-details.action.render',
(root, api) => {
const {data, close} = api;
const productId = data.selected[0]?.id;
let costPrice = 0;
const stack = root.createComponent(BlockStack);
const field = root.createComponent(MoneyField, {
label: 'Cost per item',
name: 'costPrice',
currencyCode: 'USD',
onChange: (value) => {
costPrice = value;
},
});
const saveButton = root.createComponent(
Button,
{
variant: 'primary',
onPress: async () => {
await fetch('/api/products/cost', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({productId, costPrice}),
});
close();
},
},
'Save cost price',
);
stack.appendChild(field);
stack.appendChild(saveButton);
root.appendChild(stack);
},
);Anchor to Configure regional currency pricingConfigure regional currency pricing
Display multiple money fields with different currencyCode values for regional pricing. This example renders USD, EUR, and GBP price fields in a BlockStack, each automatically formatted with the correct currency symbol and decimal precision for their locale.
Configure regional currency pricing
React
import {reactExtension, MoneyField, BlockStack, Text} from '@shopify/ui-extensions-react/admin';
function App() {
return (
<BlockStack>
<Text fontWeight="bold">Regional pricing</Text>
<MoneyField label="US price" name="priceUsd" currencyCode="USD" value={49.99} />
<MoneyField label="EU price" name="priceEur" currencyCode="EUR" value={44.99} />
<MoneyField label="UK price" name="priceGbp" currencyCode="GBP" value={39.99} />
</BlockStack>
);
}
export default reactExtension(
'admin.product-details.block.render',
() => <App />,
);TS
import {extension, MoneyField, BlockStack, Text} from '@shopify/ui-extensions/admin';
export default extension(
'admin.product-details.block.render',
(root) => {
const stack = root.createComponent(BlockStack);
const heading = root.createComponent(
Text,
{fontWeight: 'bold'},
'Regional pricing',
);
const usdField = root.createComponent(MoneyField, {
label: 'US price',
name: 'priceUsd',
currencyCode: 'USD',
value: 49.99,
});
const eurField = root.createComponent(MoneyField, {
label: 'EU price',
name: 'priceEur',
currencyCode: 'EUR',
value: 44.99,
});
const gbpField = root.createComponent(MoneyField, {
label: 'UK price',
name: 'priceGbp',
currencyCode: 'GBP',
value: 39.99,
});
stack.appendChild(heading);
stack.appendChild(usdField);
stack.appendChild(eurField);
stack.appendChild(gbpField);
root.appendChild(stack);
},
);Anchor to Validate minimum price amountValidate minimum price amount
Enforce minimum price constraints using min and the error prop for inline validation. This example prevents merchants from setting a wholesale price at zero or below, displaying an error until they've entered a valid amount.
Validate minimum price amount
React
import {useState} from 'react';
import {reactExtension, useApi, MoneyField, Button, BlockStack} from '@shopify/ui-extensions-react/admin';
function App() {
const {data, close} = useApi('admin.product-details.action.render');
const productId = data.selected[0]?.id;
const [price, setPrice] = useState(0);
const [error, setError] = useState(undefined);
return (
<BlockStack>
<MoneyField
label="Wholesale price"
name="wholesalePrice"
currencyCode="USD"
min={0.01}
required
value={price}
error={error}
onChange={(value) => {
setPrice(value);
setError(value <= 0 ? 'Wholesale price must be greater than zero' : undefined);
}}
/>
<Button
variant="primary"
onPress={async () => {
if (price > 0) {
await fetch('/api/products/wholesale-price', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({productId, wholesalePrice: price}),
});
close();
}
}}
>
Save wholesale price
</Button>
</BlockStack>
);
}
export default reactExtension(
'admin.product-details.action.render',
() => <App />,
);TS
import {extension, MoneyField, Button, BlockStack} from '@shopify/ui-extensions/admin';
export default extension(
'admin.product-details.action.render',
(root, api) => {
const {data, close} = api;
const productId = data.selected[0]?.id;
let wholesalePrice = 0;
const stack = root.createComponent(BlockStack);
const field = root.createComponent(MoneyField, {
label: 'Wholesale price',
name: 'wholesalePrice',
currencyCode: 'USD',
min: 0.01,
required: true,
onChange: (value) => {
wholesalePrice = value;
if (value <= 0) {
field.updateProps({error: 'Wholesale price must be greater than zero'});
} else {
field.updateProps({error: undefined});
}
},
});
const saveButton = root.createComponent(
Button,
{
variant: 'primary',
onPress: async () => {
if (wholesalePrice > 0) {
await fetch('/api/products/wholesale-price', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({productId, wholesalePrice}),
});
close();
}
},
},
'Save wholesale price',
);
stack.appendChild(field);
stack.appendChild(saveButton);
root.appendChild(stack);
},
);Anchor to Best practicesBest practices
- Use MoneyField instead of NumberField for prices: MoneyField handles currency-specific formatting and provides the currency code alongside the amount, making it the right choice for any monetary input.
- Narrow the onChange value type: The
onChangecallback receivesnumber | Money. WhencurrencyCodeis set, the value is aMoneyobject withamountandcurrencyCodeproperties. Otherwise, it's a plain number. Use a type check (for example,typeof value === 'object') to narrow the type before reading the value.
Anchor to LimitationsLimitations
- MoneyField doesn't automatically format the displayed value with thousands separators or decimal places based on the currency. The raw numeric input is shown as entered.
- The currency code isn't visually displayed inside the field. If you want to show the currency symbol or code, you might need to use the label or a nearby Text component.
- MoneyField supports a large set of ISO 4217 currency codes, but currency-specific rules (like the number of decimal places for JPY vs USD) aren't automatically enforced. You must validate decimal precision yourself.
- The
minandmaxprops define valid boundaries but don't prevent typing values outside the range. Validate in youronChangehandler and seterroraccordingly.