← Back to projects

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.

Node.js Express Commander JavaScript npm GPL-3.0

Install and run

zsh
$ 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.

Some pages refuse to load in a frame. Every device is an iframe, so a site that forbids embedding — with an 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 eight device viewports UIGrid renders, drawn to one shared scale iPhone SE 375×667 iPhone 14 Pro 393×852 iPad Mini 768×1024 iPad Pro 1024×1366 Nethub 1024×600 Desktop 1366×720 Desktop HD 1920×1080 Desktop 4K 2560×1440 one shared scale · every frame points at the same URL, live

The interface

Real captures of UIGrid serving this portfolio, on a screen 1440 pixels wide.

UIGrid in a browser: a URL bar reading http://localhost:4101 above device frames for Desktop 4K, Desktop HD, Desktop, Nethub, iPad Pro and iPad Mini, each showing this portfolio's home page at its own width
One URL, every frame. Type a new address in the bar and press Enter, and all eight reload. The phones sit further down the same scrolling grid.

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.

UIGrid's iPhone 14 Pro frame, 393 by 852: the portfolio's logo, name on one line, title and about text stacked for a narrow screen
iPhone 14 Pro, 393 × 852.
UIGrid's iPhone SE frame, 375 by 667: the same page, with the name wrapping onto two lines and less of the page fitting on screen
iPhone SE, 375 × 667.

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.

UIGrid — built by MilanDroid · v1.0.1 on npm All projects