A powerful development tool that helps frontend developers visualize and test responsive design breakpoints in real-time. It provides a floating panel that shows your webpage across multiple viewport sizes simultaneously, with fullscreen mode for detailed testing.
- 📱 Multi-viewport preview - See your site across different breakpoints simultaneously
- 🖱️ Fullscreen mode - Click viewport headers for detailed breakpoint testing
- 🎯 Smart trigger hiding - No recursive panels in iframe views
- 🔧 Draggable interface - Move panel and floating button independently
- ⚡ Live sync - Synchronized scrolling and form inputs across viewports
- 🎨 Theme support - Light, dark, or auto themes
- 🛡️ Dev-only - Automatically disabled in production
- 📦 Framework agnostic - Works with React, Vue, Angular, vanilla JS
npm install responsive-panel --save-dev
import { ResponsivePanel } from "responsive-panel";
const panel = new ResponsivePanel({
position: "top-right",
showLabels: true,
breakpoints: [320, 576, 768, 992, 1200, 1400],
labels: ["Mobile", "Small", "Medium", "Large", "XL", "XXL"],
});
import { injectResponsivePanel } from "responsive-panel";
// Simple injection with defaults
injectResponsivePanel();
// With custom config
injectResponsivePanel({
position: "bottom-left",
theme: "dark",
liveSync: true,
});
Option | Type | Default | Description |
---|---|---|---|
breakpoints |
number[] |
[320, 480, 768, 1024, 1280] |
Viewport widths in pixels |
labels |
string[] |
[] |
Custom labels for breakpoints |
position |
string |
'bottom-right' |
Position of floating button |
theme |
string |
'auto' |
UI theme: 'light' , 'dark' , 'auto' |
liveSync |
boolean |
false |
Sync interactions across viewports |
showLabels |
boolean |
true |
Show breakpoint labels |
zIndex |
number |
10000 |
Z-index for panel overlay |
- Open Panel: Click the floating button
- Fullscreen Mode: Click any viewport header for detailed view
- Navigate Back: Use "Back to Dashboard" button
- Drag Panel: Click and drag the panel header
- Move Button: Drag the floating button to reposition
const panel = new ResponsivePanel(config);
panel.open(); // Open the panel
panel.close(); // Close the panel
panel.toggle(); // Toggle panel visibility
panel.destroy(); // Clean up and remove panel
// Event handling
panel.on("open", () => console.log("Panel opened"));
panel.on("enterFullscreen", (event, viewport) =>
console.log("Fullscreen:", viewport)
);
open
- Panel openedclose
- Panel closedenterFullscreen
- Entered fullscreen modeexitFullscreen
- Exited fullscreen modedrag
- Panel or button dragged
The panel supports three themes:
- Light: Clean light interface
- Dark: Dark mode for night development
- Auto: Follows system preference
The responsive panel automatically detects production environments and disables itself to prevent accidental inclusion in production builds.
MIT © Responsive Panel
Contributions are welcome! Please read our Code of Conduct and check the API documentation for development guidelines.
pnpm add responsive-panel --save-dev
npm install @xarlizard/responsive-panel
Note: For GitHub Packages, you'll need to configure your
.npmrc
file. See PUBLISHING.md for details.
// index.js or main entry point
import { injectResponsivePanel } from "responsive-panel";
if (process.env.NODE_ENV !== "production") {
injectResponsivePanel();
}
import React, { useEffect } from "react";
import { injectResponsivePanel } from "responsive-panel";
function App() {
useEffect(() => {
if (process.env.NODE_ENV !== "production") {
const panel = injectResponsivePanel({
breakpoints: [320, 480, 768, 1024, 1280],
theme: "auto",
liveSync: true,
});
return () => panel?.destroy();
}
}, []);
return <div>Your app content</div>;
}
<template>
<div>Your app content</div>
</template>
<script>
import { injectResponsivePanel } from "responsive-panel";
export default {
mounted() {
if (process.env.NODE_ENV !== "production") {
this.panel = injectResponsivePanel();
}
},
beforeDestroy() {
this.panel?.destroy();
},
};
</script>
<script
src="https://unpkg.com/responsive-panel@latest/dist/index.esm.js"
type="module"
data-breakpoints="[320, 480, 768, 1024, 1280]"
data-theme="dark"
data-position="bottom-right"
></script>
injectResponsivePanel({
// Array of breakpoint widths in pixels
breakpoints: [320, 480, 768, 1024, 1280],
// Position of the floating trigger button
position: "bottom-right", // 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
// Theme for the panel UI
theme: "auto", // 'light' | 'dark' | 'auto'
// Whether to enable live sync between viewports
liveSync: false,
// Custom CSS class for the panel container
className: "my-custom-panel",
// Whether to show labels for each breakpoint
showLabels: true,
// Custom labels for breakpoints
labels: ["Mobile", "Tablet", "Desktop"],
// Z-index for the panel overlay
zIndex: 999999,
// Whether the panel starts minimized
startMinimized: false,
// Custom breakpoint configurations
customBreakpoints: [
{ width: 320, height: 568, label: "iPhone SE", enabled: true },
{ width: 768, height: 1024, label: "iPad", enabled: true },
{ width: 1440, height: 900, label: "MacBook", enabled: true },
],
});
Injects the responsive panel into the current page.
Parameters:
config
(optional): Configuration object
Returns: ResponsivePanel
instance or null
in production
const panel = injectResponsivePanel();
// Control panel visibility
panel.open();
panel.close();
panel.toggle();
// Control panel state
panel.minimize();
panel.maximize();
// Update configuration
panel.updateConfig({ theme: "dark" });
// Event listeners
panel.on("open", () => console.log("Panel opened"));
panel.on("close", () => console.log("Panel closed"));
panel.off("open", handler);
// Cleanup
panel.destroy();
open
: Panel is openedclose
: Panel is closedminimize
: Panel is minimizedmaximize
: Panel is maximizeddrag
: Panel is being draggedbreakpointToggle
: Breakpoint visibility toggled
injectResponsivePanel({
customBreakpoints: [
{ width: 320, height: 568, label: "iPhone SE", enabled: true },
{ width: 375, height: 667, label: "iPhone 8", enabled: true },
{ width: 414, height: 896, label: "iPhone 11", enabled: true },
{ width: 768, height: 1024, label: "iPad", enabled: true },
{ width: 1024, height: 768, label: "iPad Landscape", enabled: false },
{ width: 1440, height: 900, label: "MacBook", enabled: true },
],
});
const panel = injectResponsivePanel();
// Open panel programmatically
setTimeout(() => {
panel.open();
}, 2000);
// Listen for events
panel.on("open", () => {
console.log("Panel is now open");
});
panel.on("breakpointToggle", (data) => {
console.log(`Breakpoint ${data.width}px toggled`);
});
// webpack.config.js
module.exports = {
plugins: [
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify(
process.env.NODE_ENV || "development"
),
}),
],
};
// vite.config.js
export default defineConfig({
define: {
"process.env.NODE_ENV": JSON.stringify(
process.env.NODE_ENV || "development"
),
},
});
The package includes full TypeScript definitions:
import { ResponsivePanelConfig, ResponsivePanel } from "responsive-panel";
const config: ResponsivePanelConfig = {
breakpoints: [320, 768, 1024],
theme: "dark",
liveSync: true,
};
const panel: ResponsivePanel | null = injectResponsivePanel(config);
- Node.js: 14+ (for build tools)
- Browser: Modern browsers with ES2018+ support
- Framework: Works with any or no framework
- QA Testing: Visual layout testing across devices
- Development: Real-time responsive design feedback
- Design Systems: Building responsive UI components
- Client Demos: Showcasing responsive behavior
- Debugging: Identifying layout issues quickly
- Chrome 63+
- Firefox 67+
- Safari 12+
- Edge 79+
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by browser developer tools
- Built with modern web standards
- Designed for developer productivity
Made with ❤️ by Xarlizard