API

Functions

useCurrencyInput

declare const useCurrencyInput: (options: CurrencyInputOptions, autoEmit?: boolean) => UseCurrencyInput

parse

declare const parse: (formattedValue: string | null, options: CurrencyFormatOptions) => number | null

Enums

CurrencyDisplay

enum CurrencyDisplay {
  symbol = 'symbol',
  narrowSymbol = 'narrowSymbol',
  code = 'code',
  name = 'name',
  hidden = 'hidden'
}

ValueScaling

enum ValueScaling {
  precision = 'precision',
  thousands = 'thousands',
  millions = 'millions',
  billions = 'billions'
}

Interfaces

NumberRange

interface NumberRange {
  min?: number
  max?: number
}

CurrencyFormatOptions

interface CurrencyFormatOptions {
  locale?: string
  currency: string
  currencyDisplay?: CurrencyDisplay
  precision?: NumberRange | number
  accountingSign?: boolean
}

CurrencyInputOptions

interface CurrencyInputOptions extends CurrencyFormatOptions {
  /**
   * @deprecated Use `valueScaling` instead.
   */
  exportValueAsInteger?: boolean
  hideCurrencySymbolOnFocus?: boolean
  hideGroupingSeparatorOnFocus?: boolean
  hideNegligibleDecimalDigitsOnFocus?: boolean
  autoDecimalDigits?: boolean
  autoSign?: boolean
  valueRange?: NumberRange
  useGrouping?: boolean
  valueScaling?: ValueScaling
}

UseCurrencyInput

interface UseCurrencyInput {
  inputRef: Ref
  numberValue: Ref<number | null>
  formattedValue: Ref<string | null>
  setValue: (number: number | null) => void
  setOptions: (options: CurrencyInputOptions) => void
}