Skip to content

Components

Explorer Link

Link to an address, transaction or block on the chain's block explorer.

Builds the URL from chain.blockExplorers in your wagmi config, so it works on every chain you configure. Nothing is hardcoded.

Terminal window
npx shadcn@latest add @0xui/explorer-link

Pass exactly one of address, tx or block.

import { ExplorerLink } from "@/components/explorer-link";
<ExplorerLink tx={hash} />;

Uses the current chain unless you pass chainId.

<ExplorerLink block={21_000_000} chainId={8453}>
Block 21,000,000 on Base
</ExplorerLink>
import { useExplorerLink } from "@/components/explorer-link";
const { href, explorerName } = useExplorerLink({ address }, chainId);
  • Opens in a new tab with rel="noopener noreferrer". Screen readers hear “(opens in a new tab)”.
  • If the chain has no explorer, the children render as plain text with no link.

Also accepts all <a> props except href.

Prop Type Default Description
address / tx / block string / string / bigint | number — What to link to. Pass one.
chainId number current chain Chain whose explorer to use.
children ReactNode "View on <explorer>" Link text.
icon ComponentType | false ExternalLinkIcon Custom icon, or false to hide it.