# AddressCard

Shows a wallet address to receive funds, with its QR code and networks.

[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/AddressCard.tsx)

Figma: [Content/Address Card](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-4005)

## Overview

An address card renders a bordered receive card. A QR code of the address sits beside the shortened address, a copy button, and the networks that the address accepts.

## Examples

### Basic

Pass the full `address`. The card shows its first and last four characters.

```tsx
/** Demonstrates AddressCard in the documentation. @module */
import { AddressCard, style } from '@tempoxyz/ds'

export function Demo() {
  return (
    <div {...styles.frame()}>
      <AddressCard address="0x7a3f2c9b1e4d8a6f0c5b3e7d9a1f4c8e2b6d91c2" />
    </div>
  )
}

namespace styles {
  export const frame = style({ maxWidth: '28.75rem !custom', width: '100% !custom' })
}
```

[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/AddressCard/Basic.tsx)

### Networks

Add `AddressCard.Networks` with one `AddressCard.Network` per network. Set `selected` on the picked one.

```tsx
/** Demonstrates AddressCard in the documentation. @module */
import { AddressCard, style } from '@tempoxyz/ds'

export function Demo() {
  return (
    <div {...styles.frame()}>
      <AddressCard address="0x7a3f2c9b1e4d8a6f0c5b3e7d9a1f4c8e2b6d91c2">
        <AddressCard.Networks>
          <AddressCard.Network network="ethereum" selected>
            Ethereum
          </AddressCard.Network>
          <AddressCard.Network network="base">Base</AddressCard.Network>
          <AddressCard.Network network="solana">Solana</AddressCard.Network>
          <AddressCard.Network network="tempo">Tempo</AddressCard.Network>
        </AddressCard.Networks>
      </AddressCard>
    </div>
  )
}

namespace styles {
  export const frame = style({ maxWidth: '28.75rem !custom', width: '100% !custom' })
}
```

[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/AddressCard/Networks.tsx)

## Anatomy

Import the component and assemble its parts.

```tsx
import { AddressCard } from '@tempoxyz/ds'

<AddressCard>
  <AddressCard.Networks>
    <AddressCard.Network />
  </AddressCard.Networks>
</AddressCard>
```

## Guidelines

### When to Use

* Show the address that a person sends funds to, such as on a deposit screen.
* Let a person scan the address from another device or copy it.

### When Not to Use

* Use [Hex](/docs/components/hex) for an address inside a row or a sentence.
* Use [Qr](/docs/components/qr) alone for a code that encodes something other than an address.

### List Only the Accepted Networks

**Do:** List the networks that the address accepts.

```tsx
<AddressCard address="0x7a3f2c9b1e4d8a6f0c5b3e7d9a1f4c8e2b6d91c2">
  <AddressCard.Networks>
    <AddressCard.Network network="tempo" selected>
      Tempo
    </AddressCard.Network>
    <AddressCard.Network network="base">Base</AddressCard.Network>
  </AddressCard.Networks>
</AddressCard>
```

**Don't:** Leave out the networks when the address accepts only some of them.

```tsx
<AddressCard address="0x7a3f2c9b1e4d8a6f0c5b3e7d9a1f4c8e2b6d91c2" />
```

### Keep the Full Address

Pass the whole address. The card shortens the text, and the copy button and QR code use the full value.

## Content

* **Label:** Name the address from the reader's view, such as Your wallet address.
* **Networks:** Name each network as its brand does, such as Ethereum or Base.

## Accessibility

The card renders a `<div>` with no role. Screen readers read the full address, the named QR code, the copy button, and the network group.

* **Address (Full value):** Screen readers read every character, not the shortened text.
* **Copy (button):** The copy button announces Copied after a copy.
* **Networks (group):** The label names the group of network chips.
* **Pick a Network (aria-pressed):** A chip with an onClick announces its selected state.

## Related

[Hex](/docs/components/hex)

Use for an address inside a row or a sentence.

[Qr](/docs/components/qr)

Use for a QR code of another value.

[AssetChip](/docs/components/asset-chip)

Use for the chips of supported assets.
