EtherInput

The document describes the EtherInput component, which allows users to input and convert amounts between ETH and USD, detailing its import, usage, and available props.

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

Import

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

Usage

typescript
1const [ethAmount, setEthAmount] = useState("");
jsx
1 <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.