Currency - Web Component โ
Browser support โ
Parameters โ
The Web component uses the <z-currency>
tag:
The parametrization of the component can be done with the following custom HTML params:
Name | Type | Description |
---|---|---|
value | number | The value to be displayed in the currency format. |
locale (optional) | string | The locale to be used. If not set, the default locale of the browser will be used. |
currency (optional) | string | The currency to be used for formatting the value. |
decimals (optional) | number | The number of decimals to be displayed. |
value
โ
The value to be displayed as a currency.
locale
โ
The locale to be used to format the currency. If not set, the default locale of the browser will be used.
currency
โ
The currency to be used to format the currency. If not set, the default currency of the locale will be used.
decimals
โ
The number of decimals to be displayed. If not set, the default number of decimals of the currency will be used.
Playground โ
Customization โ
HTML Examples โ
Imports
html
<link rel="stylesheet" href="/0.4.2/@zurich/web-components/styles.css" />
<script type="module" src="/0.4.2/@zurich/web-components/currency.js"></script>
Code
html
<z-currency value="1.23"></z-currency>
<z-currency value="1.23" decimals="0"></z-currency>
<z-currency value="1.23" currency="USD"></z-currency>
<z-currency value="1.23" currency="MXN" locale="es"></z-currency>
<z-currency value="1005" currency="JPY" locale="jp"></z-currency>