npm i @inmortalqueen/svelte-price-formatter
<script>
import { PriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<PriceFormatter /> // $10,000.00
<script>
import { PriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<PriceFormatter price={200000} /> // $200,000.00
<PriceFormatter price={123456} /> // $123,456.00
<PriceFormatter price={123.45} /> // $123.45
<script>
import { PriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<PriceFormatter locale="es-AR" /> // $ 10.000,00
<PriceFormatter locale="es-ES" /> // 10.000,00 €
<PriceFormatter locale="ja-JP" /> // ï¿¥10,000.00
LOCALE | SYMBOL | CURRENCY |
---|---|---|
"en-CA" | $ | Canadian Dollar |
"en-GB" | £ | Pound Sterling |
"en-US" | $ | American Dollar |
"es-AR" | $ | Argentine Peso |
"es-ES" | € | Euro |
"es-MX" | $ | Mexican Peso |
"ja-JP" | ¥ | Yen |
"pt-BR" | R$ | Brazilian Real |
"pt-PT" | € | Euro |
"zh-CN" | ¥ | Yuan |
"zh-HK" | HK$ | Hong Kong Dollar |
"zh-TW" | $ | New Taiwan Dollar |
<script>
import { PriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<PriceFormatter minDecimals={0} /> // $10,000
<PriceFormatter minDecimals={1} /> // $10,000.0
<script>
import { PriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<PriceFormatter price={1000.12349} /> // $1,000.12
<PriceFormatter price={1000.12349} maxDecimals={3} /> // $1,000.123
<PriceFormatter price={1000.12349} maxDecimals={4} /> // $1,000.1235 X >= 5 = true --> 9.12349 = 9.1235
<PriceFormatter price={1000.12349} maxDecimals={5} /> // $1,000.12349
<script>
import { PriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<PriceFormatter style="color: red;" />
<script>
import { PriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<PriceFormatter class="price-formatter" />
<style>
:global(.price-formatter) {
color: blue;
}
</style>
<script>
import { PriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<PriceFormatter id="price-formatter" />
<style>
:global(#price-formatter) {
color: green;
}
</style>
<script>
import { InputPriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<InputPriceFormatter />
<script>
import { InputPriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<InputPriceFormatter placeholder="200000" />
<InputPriceFormatter placeholder="123456" />
<script>
import { InputPriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<InputPriceFormatter limit={1000} />
<InputPriceFormatter limit={10000.55} />
<script>
import { InputPriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<InputPriceFormatter locale="es-AR" />
<InputPriceFormatter locale="es-ES" />
<InputPriceFormatter locale="ja-JP" />
LOCALE | SYMBOL | CURRENCY |
---|---|---|
"en-CA" | $ | Canadian Dollar |
"en-GB" | £ | Pound Sterling |
"en-US" | $ | American Dollar |
"es-AR" | $ | Argentine Peso |
"es-ES" | € | Euro |
"es-MX" | $ | Mexican Peso |
"ja-JP" | ¥ | Yen |
"pt-BR" | R$ | Brazilian Real |
"pt-PT" | € | Euro |
"zh-CN" | ¥ | Yuan |
"zh-HK" | HK$ | Hong Kong Dollar |
"zh-TW" | $ | New Taiwan Dollar |
<script>
import { InputPriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<InputPriceFormatter maxDecimals={0} />
<InputPriceFormatter maxDecimals={4} />
<script>
import { InputPriceFormatter } from "@inmortalqueen/svelte-price-formatter";
let inputValue;
$: console.log(inputValue);
</script>
<InputPriceFormatter bind:inputValue />
<script>
import { InputPriceFormatter } from "@inmortalqueen/svelte-price-formatter";
let value;
$: console.log(value);
</script>
<InputPriceFormatter bind:value />
<script>
import { InputPriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<InputPriceFormatter style="color: red;" />
<script>
import { InputPriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<InputPriceFormatter class="input-price-formatter" />
<style>
:global(.price-formatter) {
color: blue;
}
</style>
<script>
import { InputPriceFormatter } from "@inmortalqueen/svelte-price-formatter";
</script>
<InputPriceFormatter id="input-price-formatter" />
<style>
:global(#price-formatter) {
color: green;
}
</style>