CLI tool · npm · open source
UIGrid
Preview your website on every screen size at once. One command opens a grid of eight device frames pointed at the same URL, so a responsive bug shows up in the frame it breaks in rather than after you have resized the window twelve times.
Install and run
$ npm install -g uigrid-view # start the grid, then type any URL into the interface $ uigrid # or let UIGrid serve a directory for you $ uigrid ./dist Starting UIGrid... File server running at: http://localhost:3001 Serving: /Users/you/my-site/dist UIGrid preview running at: http://localhost:3000 Press Ctrl+C to stop the server
It works against anything already serving — Vite, Next.js, Create React App, a staging URL — because it only ever points frames at a URL you give it.
X-Frame-Options header or a
frame-ancestors policy — stays blank. Many public sites do; your own
dev server and local files usually don't.
The eight frames
Drawn to relative scale. This is the actual device list the tool ships with.
The interface
Real captures of UIGrid serving this portfolio, on a screen 1440 pixels wide.
On a phone
The two phone frames from the same grid. Eighteen pixels apart in width, and the name already needs a second line on the smaller one.
How it is put together
Three files, all on GitHub.
bin/cli.js
Commander parses the arguments and decides whether a static server is needed at all.
src/server.js
Express serves the grid interface and, optionally, the local directory you pointed it at.
src/template.js
The grid itself: one iframe per device size, each with the viewport it is named after.
open
The browser is launched for you, because a tool you have to go and open is a tool you forget to use.