{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "address",
  "title": "Address",
  "description": "Address display: shows the ENS name (resolved on mainnet with useEnsName) or the checksummed, truncated 0x1234…abcd, with a copy button and an optional block-explorer link. Inline or pill variant. The text morphs from the address to the ENS name when it resolves (MorphText). Full address on hover and for screen readers. Exports useAddressName.",
  "dependencies": [
    "wagmi",
    "viem"
  ],
  "registryDependencies": [
    "@0xui/copy-button",
    "@0xui/explorer-link",
    "@0xui/0xui-utils",
    "@0xui/morph-text"
  ],
  "files": [
    {
      "path": "registry/default/components/address.tsx",
      "content": "// Docs: https://0xui.io/components/address.md\nimport { getAddress, type Address as AddressType } from \"viem\";\nimport { useEnsName } from \"wagmi\";\nimport { mainnet } from \"wagmi/chains\";\nimport { CopyButton } from \"@/components/copy-button\";\nimport { ExplorerLink } from \"@/components/explorer-link\";\nimport { MorphText } from \"@/components/morph-text\";\nimport { truncateAddress } from \"@/lib/0xui-utils\";\nimport { cn } from \"@/lib/utils\";\n\nexport type AddressProps = {\n  address: AddressType;\n  /** Show the ENS name instead of the address when one resolves. Requires mainnet in your wagmi config. */\n  ens?: boolean;\n  /** Name to show instead of the address. Skips the ENS lookup. */\n  name?: string;\n  /** \"inline\" for running text, \"pill\" for a bordered chip. */\n  variant?: \"inline\" | \"pill\";\n  /** Show a copy button. */\n  copyable?: boolean;\n  /** Link the address to the block explorer of the current chain. */\n  explorer?: boolean;\n  /** Characters kept at the start and end when truncating. */\n  truncate?: { start?: number; end?: number };\n  className?: string;\n};\n\n/** Display name for an address: an explicit name, its ENS name, or the truncated address. */\nexport function useAddressName(\n  address: AddressType,\n  { ens = true, name }: { ens?: boolean; name?: string } = {}\n) {\n  const { data: ensName, isLoading } = useEnsName({\n    address,\n    chainId: mainnet.id,\n    query: { enabled: ens && !name },\n  });\n  const checksummed = getAddress(address);\n  const resolved = name ?? ensName ?? undefined;\n  return { name: resolved, checksummed, isLoading };\n}\n\n/**\n * Address display: ENS name or checksummed `0x1234…abcd`, with copy and\n * explorer link. The full address is always available on hover and to\n * screen readers.\n */\nexport function Address({\n  address,\n  ens = true,\n  name: nameProp,\n  variant = \"inline\",\n  copyable = true,\n  explorer = false,\n  truncate,\n  className,\n}: AddressProps) {\n  const { name, checksummed } = useAddressName(address, {\n    ens,\n    name: nameProp,\n  });\n  const text = name ?? truncateAddress(checksummed, truncate);\n\n  const label = (\n    <span\n      title={checksummed}\n      className={cn(!name && \"font-mono tabular-nums\", \"truncate\")}\n    >\n      {/* Morphs from the address to the ENS name when it resolves. */}\n      <span aria-hidden>\n        <MorphText>{text}</MorphText>\n      </span>\n      <span className=\"sr-only\">{name ? `${name}, ${checksummed}` : checksummed}</span>\n    </span>\n  );\n\n  return (\n    <span\n      data-slot=\"address\"\n      className={cn(\n        \"inline-flex min-w-0 items-center gap-1 align-middle\",\n        variant === \"pill\" && \"rounded-full border px-2.5 py-0.5 text-sm\",\n        className\n      )}\n    >\n      {explorer ? (\n        <ExplorerLink address={checksummed} icon={false} className=\"min-w-0\">\n          {label}\n        </ExplorerLink>\n      ) : (\n        label\n      )}\n      {copyable && <CopyButton value={checksummed} label=\"Copy address\" />}\n    </span>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "docs": "Docs: https://0xui.io/components/address.md",
  "categories": [
    "identity"
  ],
  "type": "registry:component"
}