Using lightning:input with type="number" and formatter="currency"

Salesforce Asked by Jay Bolt on December 4, 2020

Is there a way to use lightning:input with formatter=”currency” to show whole number instead of Decimal number

<lightning:input aura:id="{!item.Id + 'CY_Tile_Budget__c' }" 
   type="number" name="CY_Budget__c" 
   label="CY Budget " value="{!item.CY_Budget__c}"  
   formatter="currency"  step="1" min="0" />

For example if item.CY_Budget__c is 10 I want it to display $10 instead of $10.00?

Is that possible?

One Answer

It looks like you already have the solution, I was able to accomplish this using the step attribute and setting it equal to 1.

<lightning:input label="Input" type="number" formatter="currency" variant="label-hidden" value="{!v.value}" step="1"></lightning:input>

This is working on API Version 43.0

Answered by byrner on December 4, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP