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.
Installation
Section titled “Installation”npx shadcn@latest add @0xui/explorer-linkpnpm dlx shadcn@latest add @0xui/explorer-linkyarn dlx shadcn@latest add @0xui/explorer-linkbunx --bun shadcn@latest add @0xui/explorer-linkPass exactly one of address, tx or block.
import { ExplorerLink } from "@/components/explorer-link";
<ExplorerLink tx={hash} />;Uses the current chain unless you pass chainId.
Examples
Section titled “Examples”Custom text and chain
Section titled “Custom text and chain”<ExplorerLink block={21_000_000} chainId={8453}> Block 21,000,000 on Base</ExplorerLink>Headless
Section titled “Headless”import { useExplorerLink } from "@/components/explorer-link";
const { href, explorerName } = useExplorerLink({ address }, chainId);Behavior
Section titled “Behavior”- 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. |
