shadcn.io is not affiliated with official shadcn/ui
Magnifier Lens Features Block for React
An inspection lens over a dense latency table: a magnified copy clipped to a circle follows the pointer and a readout names the cell under it, with arrow keys to move it and a tap-to-pin readout on a phone.
Installation
Overview
A data inspector for React with Base UI. A dense table of eight routes and five measures sits in a hairline frame with + marks on its corners. As the pointer moves, a lens follows it: a second copy of the table, magnified 2.2 times, clipped to a circle, with the cell under the pointer marked. A readout band under the table names that cell ("Row 4 · GET /v2/customers · p95 · 61 ms"). The table is a real table; the arrow keys move the lens cell by cell when the figure has focus, Escape puts it away, and on a phone a tap pins the readout to a cell instead of showing the lens. The page's rails and top rule come from the Guides spine. It's built from Kbd and Guides, two CSS variables written by a pointer handler, and your theme's tokens for every colour. For analytics, observability and any page that has to show dense numbers honestly.
FAQ
How do I change the table?
Edit COLUMNS and ROWS at the top of the file: each row has a route and one string per column in values. Columns with keep: false drop out on a phone to keep the table readable. The readout, the lens and the highlight all read from the same two arrays.
How does the lens work?
The lens is a circle with a second copy of the table inside it, scaled 2.2 times from its top corner and shifted so the point under the pointer lands at the centre. A pointer handler writes the point as CSS variables (and the table's width, so the copy lays out the same); everything else is CSS. The copy is hidden from assistive technology and inert, and the real table is the one that is read.
Does it work from the keyboard?
Yes. The figure is a tab stop. When it has focus the lens appears on the first cell, the arrow keys move it one cell at a time (and the readout is a polite live region while you do), and Escape puts the lens away. Moving the pointer takes over again.
What happens with reduced motion?
The lens follows the pointer exactly, with no easing, since it is a direct response to the pointer. Jumps from the arrow keys ease only without a reduced-motion preference. The entrance fade is off.
Related
- Pro
Dock Magnifier Features
Live controlsA dock of eight tool tiles that grow with their distance from the pointer, under a detail card that follows the active tile, built on tabs so the arrow keys and a tap work too.
- Pro
Heatmap Density Grid Features
Metrics and chartsA 24 by 12 traffic density grid in a framed figure with a legend, three numbered callout cells, and the callouts described beside it, for a traffic observability tool.
- Pro
Keyboard Focus Grid Features
Live controlsA six-cell feature grid for a keyboard-first notes app: one focus ring glides between cells with the arrow keys, and Enter or a tap writes the cell's detail into a strip under the grid.
- Pro
Analytics Widget Dashboard Features
Metrics and chartsA job-queue dashboard drawn as a window in a hairline frame: a range control in its title bar re-draws the throughput line and re-reads the uptime and outcome figures, beside a seven-bar week.
- Pro
Vertical Slider Board Features
Live controlsA board of six vertical sliders for an alert-tuning tool, each with a level meter and a readout, and a composite readout of pages a week and incidents caught worked out from the six settings.
- Pro
Before After Toggle Features
Live controlsA Before and After control that cross-fades a settings screen between a cluttered version (warning banners, a nested menu, badges everywhere) and a clean one, in a frame that never changes height.