BigBlocks

Receive Address

QR code and deposit address display with clipboard copy and optional address rotation. Supports default, compact, and inline variants.

Compact

Inline

Installation

bunx shadcn@latest add https://registry.bigblocks.dev/r/receive-address.json

Usage

The composed ReceiveAddress component wires the hook and UI together. Pass an address and optional callbacks for rotation and copy.

import { ReceiveAddress } from "@/components/blocks/receive-address"
 
export function DepositPage() {
  return (
    <ReceiveAddress
      address="1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
      onRotate={async () => {
        const newAddr = await generateNewAddress()
        return newAddr
      }}
      onCopy={(addr) => console.log("Copied:", addr)}
    />
  )
}

Variants

Default

Full card with QR code, address text, copy button, and optional rotate button.

<ReceiveAddress address={address} variant="default" />

Compact

Smaller layout with a reduced QR code size. Useful for sidebars and panels.

<ReceiveAddress address={address} variant="compact" qrSize={120} />

Inline

Horizontal layout with address and copy button only -- no QR code.

<ReceiveAddress address={address} variant="inline" />

Props

ReceiveAddress

PropTypeDefaultDescription
addressstring | nullrequiredThe deposit address to display
onRotate() => Promise<string>--Callback to rotate to a new address
onCopy(address: string) => void--Called after address is copied
variant"default" | "compact" | "inline""default"Visual layout variant
qrSizenumber200QR code pixel dimensions
renderQr(address: string) => ReactNode--Custom QR code renderer
classNamestring--Additional CSS classes

Hook

useReceiveAddress can be used independently for a fully custom UI.

import { useReceiveAddress } from "@/components/blocks/receive-address"
 
function CustomReceive() {
  const { copied, isRotating, rotateError, copyAddress, rotateAddress } =
    useReceiveAddress({
      address: "1A1zP1eP...",
      onRotate: async () => generateNewAddress(),
    })
 
  return (
    <div>
      <button onClick={copyAddress}>{copied ? "Copied" : "Copy"}</button>
      <button onClick={rotateAddress} disabled={isRotating}>
        Rotate
      </button>
      {rotateError && <p>{rotateError.message}</p>}
    </div>
  )
}