StealThis .dev

Web3 — Network / Chain Switcher

A glassy Web3 network switcher with a current-chain pill that opens a searchable menu of fictional chains — Ethereum, Arbitrum, Base, Optimism, Polygon and Lumen Chain — each with a colored icon, online or degraded status dot, and a collapsible testnet section. Selecting a chain triggers a simulated Switching network state, then updates the pill, the hero card with animated block count, monospace gas and RPC values, and retints the whole page accent to match the active network.

Ouvrir dans Lab
html css vanilla-js
Targets: JS HTML

Code

Network / Chain Switcher

A compact chain selector built for Web3 dapp headers. The current-network pill shows a colored token icon, the chain name, its network type, and a live status dot. Clicking it opens a glassy, blurred dropdown listing six fictional networks — Ethereum, Arbitrum, Base, Optimism, Polygon and Lumen Chain — each row carrying an icon, a chain ID, and an online or degraded indicator.

A search input filters the list as you type, arrow keys move focus between rows, and esc closes the menu. A Show testnets toggle at the bottom reveals additional testnet chains (Sepolia, Lumen Testnet) tagged with a badge. Picking a network shows a brief Switching network… overlay with a simulated RPC delay, then commits the change.

On switch, everything retints: the pill, the hero card icon, the page background orbs and all accent colors follow the active chain. The hero block height counts up with an eased animation, and gas, latency and RPC values render in monospace. A small toast confirms each action, and the wallet pill copies a fictional address. Everything is vanilla JS — no wallet, no libraries.

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