DevExtreme v26.1 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

Vue Number Box - Formatting

Use the format property to specify the integer, currency, accounting, percent, and other formats of the NumberBox value.

Backend API
<template> <div> <div class="dx-fieldset"> <div class="dx-field"> <div class="dx-field-label">Integer format</div> <div class="dx-field-value"> <DxNumberBox :value="14500" format="#" :input-attr="{ 'aria-label': 'Integer Format' }" /> </div> </div> <div class="dx-field"> <div class="dx-field-label">Currency format</div> <div class="dx-field-value"> <DxNumberBox :value="14500.55" format="$ #,##0.##" :input-attr="{ 'aria-label': 'Currency Format' }" /> </div> </div> <div class="dx-field"> <div class="dx-field-label">Accounting format</div> <div class="dx-field-value"> <DxNumberBox :value="-2314.12" format="$ #,##0.##;($ #,##0.##)" :input-attr="{ 'aria-label': 'Accounting Format' }" /> </div> </div> <div class="dx-field"> <div class="dx-field-label">Percent format</div> <div class="dx-field-value"> <DxNumberBox :value="0.15" :step="0.01" format="#0%" :input-attr="{ 'aria-label': 'Percent Format' }" /> </div> </div> <div class="dx-field"> <div class="dx-field-label">Fixed point format</div> <div class="dx-field-value"> <DxNumberBox :value="13415.24" format="#,##0.00" :input-attr="{ 'aria-label': 'Fixed Point Format' }" /> </div> </div> <div class="dx-field"> <div class="dx-field-label">Weight format</div> <div class="dx-field-value"> <DxNumberBox :value="3.14" format="#0.## kg" :input-attr="{ 'aria-label': 'Weight Format' }" /> </div> </div> </div> </div> </template> <script setup lang="ts"> import DxNumberBox from 'devextreme-vue/number-box'; </script> <style> .dx-field { margin-bottom: 20px; } </style>
import { createApp } from 'vue'; import App from './App.vue'; createApp(App).mount('#app');
<!DOCTYPE html> <html lang="en"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/26.1.5/css/dx.light.css" /> <link rel="stylesheet" type="text/css" href="./bundle.css" /> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="app"> </div> </div> <script src="bundles/vendor/vue.vendor.js"></script> <script src="./bundle.js"></script> </body> </html>

The format property can accept the following value types:

  • Predefined format
    See the type property description for a list of accepted values.

  • Custom format string
    Use a LDML pattern to specify a custom format. Refer to the following article for more information: Custom Format String.

  • Function
    A function should apply a custom format to a value and return the formatted value as a string. Functions are useful for advanced formatting.

  • Object
    Full format configuration. The object structure is shown in the format API section.