Skip to main content

IntegerInput

Provides an input field for integer values, validating that user input it's a valid integer, and showing error if not.
Shows by default a small button to multiply input's value * 10^18 to transform to wei.

IntegerInput Example

Import

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

Usage

const [txValue, setTxValue] = useState<string | bigint>("");

<IntegerInput
value={txValue}
onChange={updatedTxValue => {
setTxValue(updatedTxValue);
}}
placeholder="value (wei)"
/>;

Props

PropTypeDefault ValueDescription
valuestringundefinedThe data that your input will show.
onChangefunctionundefinedA callback invoked when the amount in the input changes.
placeholder (optional)stringundefinedThe string that will be rendered before input data has been entered.
name (optional)stringundefinedHelps identify the data being sent if InputBase is submitted into a form.
error (optional)booleanfalseWhen set to true changes input border to have error styling.
disabled (optional)booleanfalseWhen set to true changes input background color and border to have disabled styling.