A Chrome extension for responsive design testing that allows you to quickly view and resize web pages to different viewport sizes. Built with SolidJS, TypeScript, and Vite.
- One-Click Preview: Click the extension icon to instantly open the current page in a resizable popup window
- Custom Viewport Presets: Create and manage custom viewport presets for different devices (iPhone, iPad, desktop, etc.)
- Keyboard Shortcuts: Use
Cmd/Ctrl + 1-9to instantly resize windows to your saved presets - Real-Time Dimension Overlay: See viewport dimensions displayed as you resize windows
- Drag-and-Drop Reordering: Organize your presets in any order via drag-and-drop
- Auto-fill Device Templates: Quick selection of common device sizes (iPhone 15 Pro, iPad Air, MacBook Pro, etc.)
- Customizable Settings: Configure overlay timeout and manage unlimited viewport presets
-
Install dependencies:
npm install
-
Start development server:
npm run dev
-
Load the extension in Chrome:
- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" (toggle in top right)
- Click "Load unpacked"
- Select the
distdirectory from the project
- Open Chrome and navigate to
Build the extension for distribution:
npm run buildThe built extension will be in the dist directory and a packaged .zip file will be created in the release directory.
- Navigate to any webpage
- Click the Quick Viewport extension icon in your toolbar
- The page will open in a new popup window with the first preset size (or default mobile size)
- Right-click the extension icon and select "Options" (or navigate to the settings page)
- Add custom presets:
- Click "+ Add Preset"
- Choose from common device templates or enter custom dimensions
- Enter a name, width, and height
- Click "Add"
- Edit or remove existing presets using the Edit/Remove buttons
- Reorder presets by dragging them (the first 9 presets can be accessed via keyboard shortcuts)
When a viewport window is open, use these shortcuts to quickly resize:
Cmd + 1(orCtrl + 1on Windows/Linux): Resize to first presetCmd + 2: Resize to second presetCmd + 3-9: Resize to respective presets
- Automatically appears when resizing a viewport window
- Shows current viewport dimensions (width × height)
- Displays preset name when using keyboard shortcuts
- Timeout is customizable in settings (default: 500ms)
src/
├── background/
│ └── service-worker.ts # Background script handling window creation and shortcuts
├── options/
│ ├── App.tsx # Settings/options page UI
│ └── index.html # Settings page entry
├── utils/
│ ├── device-presets.ts # Common device viewport presets
│ ├── dimension-overlay-injector.ts # Injects overlay into popup windows
│ └── settings.ts # Settings storage management
└── manifest.config.ts # Chrome extension manifest configuration
- SolidJS: Reactive UI framework
- TypeScript: Type-safe JavaScript
- Vite: Fast build tool and dev server
- CRXJS: Vite plugin for Chrome extension development
- Chrome Extension Manifest V3: Latest extension platform
The extension manifest is configured in manifest.config.ts. Key permissions:
storage: Save user settings and presetstabs: Access current tab informationscripting: Inject dimension overlay into popup windowshost_permissions: Required for dimension overlay injection
All settings are stored in Chrome's sync storage:
dimensionOverlayTimeout: Duration (in ms) the overlay stays visiblewindowPresets: Array of viewport presets with id, name, width, and height
- Background scripts handle extension icon clicks and window management
- Settings page provides full preset management UI
- Dimension overlay is injected dynamically into popup windows
- Device presets are centralized in a shared constants file
- Dynamic Injection: The dimension overlay script is injected into popup windows to avoid CSP issues
- Message Passing: Keyboard shortcuts in popup windows communicate with the background script via message passing
- Sync Storage: Settings sync across devices when user is signed into Chrome