Skip to main content
On this page

A form field for entering monetary amounts, with a currency symbol prefix

When to use​

  • When the user needs to enter a monetary amount, such as a payment value, budget, or balance
  • When the currency context helps users understand what to enter, for example when the amount could be confused with a percentage or unit quantity
  • When the accepted currencies are GBP, EUR, AUD, or USD

When not to use​

  • For plain numbers without currency context - use Text Field instead.
  • To display a read-only currency value - use Summary List or a plain text element instead.
  • For currencies other than GBP, EUR, AUD, or USD - the component does not support other currencies. Use Text Field with appropriate labelling instead.
  • To indicate that a field is unavailable - the disabled state is not supported. Use Summary List to show values that cannot be edited, or conditionally hide the field if it is not relevant in the current context.

Anatomy​

  1. Label
  2. Hint
  3. Currency symbol (displayed as a prefix icon inside the input, not editable by the user)
  4. Input
  5. Error message
  6. Required/Optional indicator

Basic usage​

Loading...
Edit live code
<CurrencyField id="saving" label="Saving" characters={10} />

Variants and features​

Currency​

Use the currency prop to set the currency. The symbol is displayed as a prefix inside the input and announced to screen readers via a visually hidden label.

Supported values: GBP (default), EUR, AUD, USD.

Loading...
Edit live code
<Stack spaceBetween={4}>
  <CurrencyField id="saving-gbp" label="Pounds" characters={10} />
  <CurrencyField id="saving-eur" label="Euros" currency="EUR" characters={10} />
  <CurrencyField id="saving-aud" label="Australian dollars" currency="AUD" characters={10} />
  <CurrencyField id="saving-usd" label="US dollars" currency="USD" characters={10} />
</Stack>

Common form features​

The following features are shared across all Nebula form fields. See Form guidance for full detail.

Validation and errors: when a field is invalid, an error message appears below the input and the input border changes to indicate the error state.

Hint text: use the hint prop to provide additional context. For currency fields, hint text is useful for clarifying expected format, for example "Do not include pence" or "Enter the amount in pounds".

Required and optional: fields are required by default. Use the optional prop to mark a field as optional. The required or optional state is indicated visually as part of the label.

Field width: use the characters prop to set the input width to match the expected length of the content. The default of 25 characters is appropriate for most monetary amounts. Currency Field is responsive by default and displays full width below the smallest breakpoint. Override with fullWidth="always" or fullWidth="never".

Loading...
Edit live code
<Stack spaceBetween={4}>
  <CurrencyField
    id="saving-error"
    label="Monthly payment"
    error="Enter an amount"
  />
  <CurrencyField
    id="saving-hint"
    label="Monthly payment"
    hint="Do not include pence"
  />
  <CurrencyField id="saving-optional" label="Additional payment" optional />
  <CurrencyField id="saving-width" label="Monthly payment" characters={10} />
</Stack>

Grouping​

Currency fields are typically part of a larger form. See the Form component and form guidelines for guidance on grouping and layout.