Getting started
Install
Section titled “Install”npm install -D msw-panelpnpm add -D msw-panelyarn add -D msw-panelbun add -d msw-panelAdd to your app
Section titled “Add to your app”import { createMswPanelController } from "msw-panel";import { MswPanel } from "msw-panel/react";import { worker } from "./mocks/browser";
const controller = createMswPanelController({ runtime: worker });
export function App() { return ( <> <Routes /> <MswPanel controller={controller} /> </> );}That’s it. A floating button appears in the corner. Click it to open the panel and toggle handlers on or off.
Notice what you didn’t have to do: no rewriting handlers, no wrapping your worker, no changing how you call setupWorker. The panel reads the handlers MSW already knows about.
Next steps
Section titled “Next steps”Everything above is the whole baseline. From here you can opt into more, one piece at a time. None of it changes the setup you just wrote:
- Feature tags: wrap a handler with
withTags(handler, ["auth"])to make it searchable and groupable. No config changes. - Scenarios: turn one endpoint into
defineScenariosto switch it betweensuccess/empty/errorstates from the panel. Your existing resolver becomes the default scenario.
See the React reference for all props and defaults.