Address

A component for displaying Ethereum addresses with optional abbreviation.

Address

The Address component displays Ethereum addresses with optional abbreviation and validation.

Usage

import { Address } from '@avalabs/builderkit';
 
// Basic usage
<Address address="0x1234567890123456789012345678901234567890" />
 
// With abbreviation
<Address 
  address="0x1234567890123456789012345678901234567890"
  abbreviate={true}
/>
 
// Using context (inside Identity provider)
<Address abbreviate={true} />

Props

PropTypeDefaultDescription
addressstring-The Ethereum address to display (optional if used within Identity context)
abbreviatebooleanfalseWhether to show abbreviated address (e.g., 0x1234...5678)

Features

  • Validates input address using ethers.isAddress
  • Supports address abbreviation (0x1234...5678)
  • Can use address from Identity context if not provided directly
  • Throws error for invalid addresses

Examples

Basic Display

<Address address="0x1234567890123456789012345678901234567890" />
// Output: 0x1234567890123456789012345678901234567890

Abbreviated Display

<Address 
  address="0x1234567890123456789012345678901234567890"
  abbreviate={true}
/>
// Output: 0x1234...5678

With Identity Context

<Identity address="0x1234567890123456789012345678901234567890">
  <Address abbreviate={true} />
</Identity>

Error Handling

The component will throw an error if:

  • No address is provided (either via props or context)
  • The provided address is not a valid Ethereum address

Is this guide helpful?

On this page

Privacy Policy

We respect your privacy and are committed to protecting your personal data. This privacy policy will inform you about how we look after your personal data and tell you about your privacy rights.

Read full policy