Skip to main content

EtherInput

Displays input field for ETH/USD amount, with an option to convert between ETH and USD.

EtherInput Example

Import

import { EtherInput } from "~~/components/scaffold-eth";

Usage

const [ethAmount, setEthAmount] = useState("");

<EtherInput value={ethAmount} onChange={amount => setEthAmount(amount)} />;

Props

PropTypeDefault ValueDescription
valuestringundefinedYou can enter ether quantity or USD quantity, but value will be always stored in ETH.
onChangefunctionundefinedA callback invoked when the amount in the ether input changes.
placeholder (optional)stringundefinedThe string that will be rendered before ether input has been entered.
name (optional)stringundefinedHelps identify the data being sent if EtherInput is submitted into a form.
disabled (optional)booleanfalseWhen set to true changes input background color and border to have disabled styling.