Skip to main content

EtherInput

Displays an 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 always be stored in ETH.
onChangefunctionundefinedA callback invoked when the amount in the EtherInput changes.
placeholder (optional)stringundefinedThe string that will be rendered when there is no input value.
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.