Skip to 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 "@scaffold-ui/components";

Usage

const [ethAmount, setEthAmount] = useState("");
<EtherInput onValueChange={({ valueInEth, valueInUsd, displayUsdMode }) => setEthAmount(valueInEth)} />

Props

PropTypeDefault ValueDescription
defaultValue (optional)stringundefinedInitial value for the input (in ETH).
defaultUsdMode (optional)booleanfalseWhen set to true, the input starts in USD mode instead of ETH.
onValueChange (optional)(value: { valueInEth: string; valueInUsd: string; displayUsdMode: boolean }) => voidundefinedCallback fired when the value or display mode changes. Provides both ETH and USD values.
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.
style (optional)CSSPropertiesundefinedCustom CSS styles to apply to the component.