AddressInput
An input component for Ethereum addresses with built-in validation.
AddressInput
The AddressInput component provides a specialized input field for Ethereum addresses with real-time validation.
Usage
Props
Prop | Type | Default | Description |
---|---|---|---|
placeholder | string | - | Placeholder text |
value | string | "" | Controlled input value |
disabled | boolean | false | Whether the input is disabled |
icon | ReactNode | - | Optional icon element |
onChange | (address: string) => void | - | Called with valid address or empty string |
className | string | - | Additional CSS classes |
Features
- Real-time Ethereum address validation using
viem
- Visual feedback for invalid addresses
- Only emits valid addresses through onChange
- Optional icon support
- Controlled value management
- Error state styling
Examples
Basic Address Input
With Error Handling
With Custom Styling
In a Form
Validation States
- Initial: No validation indicator
- Valid: No visual feedback (clean state)
- Invalid: Red ring around input
- Disabled: Grayed out appearance
Edit on GitHub
Last updated on