StealThis .dev

Web3 — Address Chip (truncate · copy · ENS)

A reusable wallet identity chip for Web3 interfaces, rendered across every variant you actually ship: a middle-truncated monospace address, an ENS-resolved name with a gradient blockie avatar derived from the address bytes, a copy-on-click chip with clipboard write and a checkmark flip, and a chip that links out to a block explorer. It ships in small, medium, and large densities with online, idle, and offline status dots, plus a hero account card that toggles between raw and resolved display.

Відкрити в Lab
html css vanilla-js
Цілі: JS HTML

Код

Address Chip (truncate · copy · ENS)

The single most repeated primitive in any wallet, explorer, or DeFi dashboard is the address chip — and this is that chip in every form it usually takes. A hero account card pairs a 56px gradient blockie with a resolved name and a large copy chip, then a variant gallery breaks the component down into its modes: a raw middle-truncated address (0x4b81…c20e) in JetBrains Mono, an ENS-resolved name with its own avatar, a copy-on-click action, and an explorer link. Each blockie is generated deterministically from the address string, so the same wallet always renders the same little gradient.

Interactions are all client-side and self-contained. Clicking any copy chip writes the full address to the clipboard, fires a toast that echoes the truncated hash, and flips its icon from copy to a green checkmark before settling back. The hero card’s toggle switches between the ENS name and the raw address, and the explorer chips intercept their click to show a simulated Opening on Lumen Scan toast instead of navigating away. Everything is keyboard-usable with visible focus rings.

A sizes-and-status row shows the chip at small, medium, and large densities, each carrying an online, idle, or offline status dot with a small legend below. The layout is glassy and neon-accented, collapses to a single column at 360px, and respects prefers-reduced-motion. No frameworks, no web3 libraries — just HTML, CSS, and vanilla JS.

UI-only simulation — no real wallet, RPC, or on-chain calls. Mock data, fictional tokens.