Grapes homepage1.57.0
  • Guide
  • Tokens
  • Components
    Grapes on GithubGrapes on Figma
    Interaction
    • Button
    • IconButton
    • FloatingActionBar
    • Link
    Icons
    • Icon
    • HighlightIcon
    Form
    • AmountInput
    • Autocomplete
    • AutocompleteMultiple
    • AutocompletePlace
    • CheckboxBox
    • CheckboxField
    • DatePicker
    • FormField
    • Input
    • OptionGroup
    • PasswordInput
    • PhoneInput
    • RadioBox
    • RadioField
    • RadioGroup
    • Select
    • SwitchField
    • TextArea
    • TextInput
    • Upload
    • UploadButton
    Feedback
    • Badge
    • Banner
    • Callout
    • EmptyState
    • Modal
    • ModalSlideshow
    • DeprecatedModalSlideshow
    • PageModal
    • Skeleton
    • Tag
    • Toast
    • Tooltip
    Data display
    • Accordion
    • Avatar
    • Box
    • Calendar
    • CalendarRange
    • CollapsibleList
    • FileCard
    • InfoTip
    • ListBox
    • ListView
    • Panel
    • SidePanel
    • DeprecatedPreview
    • Table
    • Timeline
    • useDateFormatter
    Navigation
    • DropdownItem
    • DropdownMenu
    • Navigation
    • NavigationItem
    • Popover
    • Tabs

    AmountInput

    The AmountInput is a number input designed to handle currency amounts.

    View source code
    • Usage
    • Props
    • currency
      AmountInputCurrency

      The currency to display.

    • onChange
      (event: ChangeEvent<HTMLInputElement>, newValue: number) => void

      Handler that is called when the value changes. When reading the new value, it is recommended to use the 'newValue' parameter rather than event.target.valueAsNumber to ensure the value is correctly formatted.

    • value
      number

      The current value (controlled).

    • className
      string

      className for the element.

    • currencies
      AmountInputCurrency[]

      The list of currencies to display in the dropdown.

    • fit
      "content" | "parent"

      Whether the AmountInput should fit its parent or content.

      Default: content
    • hasNegativeValueAllowed
      boolean

      Whether the AmountInput allows negative values.

    • id
      string

      The id of the AmountInput.

    • isDisabled
      boolean

      Whether the AmountInput is disabled.

    • isInvalid
      boolean

      Whether the AmountInput is invalid.

    • leftAddon
      ReactNode

      Left addon of the input.

    • name
      string

      The name of the AmountInput, used when submitting an HTML form.

    • onBlur
      FocusEventHandler<HTMLInputElement>

      Handler that is called when the element loses focus.

    • onFocus
      FocusEventHandler<HTMLInputElement>

      Handler that is called when the element receives focus.

    • onKeyDown
      KeyboardEventHandler<HTMLInputElement>

      Handler that is called when a key is pressed.

    • onPaste
      ClipboardEventHandler<HTMLInputElement>

      Handler called when clipboard content is pasted into the amount field.

    • onSelectCurrency
      (selectedCurrency: AmountInputCurrency, newValue: number) => void

      Handler that is called when a currency is selected.

    • placeholder
      string

      Temporary text that occupies the AmountInput when it is empty.

    • variant
      "default" | "magicGradient"

      The visual style of the AmountInput.

      Default: default