Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>PictureCode — Live UI PreviewsNew to Visual Studio Code? Get it now.
PictureCode — Live UI Previews

PictureCode — Live UI Previews

Otajon Murodov

|
12 installs
| (0) | Free
See what your code looks like. PictureCode screenshots every page of your running app (faking backend data from your types, zod schemas and what the page reads when the API is down) and shows the exact component you're editing in the minimap.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

PictureCode — see what your code looks like

PictureCode takes pictures of your running web app and shows the exact component you are editing, docked at the bottom of the minimap. Open search-results.tsx and you see the search results page. Open search-header.tsx and you see only the header.

  • Automatic. Run yarn dev, npm run dev, pnpm dev, next dev, ng serve or similar in the VS Code terminal. PictureCode spots the dev server URL in the terminal output and photographs every page in the background.
  • Works without a backend. If an API call fails (server offline, 401, 500, timeout, or a 200 whose body is an error such as { errorCode: 401 }), PictureCode answers it with fake data built from your code:
    • TypeScript types. http.post<ITicketSearchResponse>('/tickets/search') gets back a believable ITicketSearchResponse: 6 tickets with names, dates, statuses from your union types, and a total that matches the list.
    • zod and valibot schemas. When the response goes through Schema.parse(…), the data passes it: regex(/^[A-Z]{3}$/) gives DYU, uuid() a UUID, datetime() an ISO date, enums one of their values, min(1) lists at least one item. The page shows data instead of its error state.
    • How the code reads the response. const dtos: IPassengerDTO[] = response.data.payload.passengers answers { payload: { passengers: [...] } } with IPassengerDTOs, even when the HTTP call itself is untyped.
    • Your own mock data and comments. Objects in mock providers and fixtures fill matching objects, sample values in comments (airline: string // "Аэрофлот") shape fields, and string fields the code casts to a union take those values.
    • What the page reads. For calls nothing else explains (Promise<any>, plain res.json()), the first answer is a guess; PictureCode records which fields the page reads from it (data.meta.total, items[].sender.fullName, amount.toFixed(2)) and loads the page again with exactly those fields.
  • Loading, empty and error states too. For every page that loads data, PictureCode also pictures it while the requests are pending, with every list empty, and with the API failing. The page with data stays the main picture; the other states are one click away.
  • One picture per page. Each page is rendered once. Component pictures are cut from that page image inside the browser and saved as WebP. Files are named by their content, so a component that didn't change costs nothing to save again, and pages that look the same are stored once.
  • Incremental. When you save a file, only the pages that show components from that file are captured again.
  • Instant on open. Open a component file that has no picture yet and its components are rendered on their own straight away, from their prop types and interfaces, in a few seconds. This runs beside the full capture (it doesn't wait for every page to be pictured), and on a large project it doesn't even wait for the whole project to be analyzed: a small TypeScript program around the opened file is enough. For very large projects, set autoCapture to onOpen and only the files you open (and save) are pictured.
  • Role-gated and backend-only UI is pictured too. A component that hides itself behind a role or a signed-in user (<Can I="edit">, <RequireRole>, <Authorization allowedRoles={[ROLES.ADMIN]}>, hasPermission(user, 'x'), user.role === 'ADMIN' && …, if (!user) return null, an empty store before sign-in) is rendered as a user with every permission, with the data its hooks would bring. Pages that say "403" or send the signed-in user to the login page are taken again the same way. Server Components that need a database or a session get generated data when the call fails. Your files are never changed (see Opened-up copies below).

Every component gets a picture

PictureCode reaches components in three ways, in this order:

  1. Pages. It visits every route it finds (router config, file-based routes, links), filling route parameters with fake values.
  2. UI states. On each page it clicks the buttons that open things: modals, drawers, dropdowns, tabs, accordions. Then it pictures the components that appear, such as a TicketFilters modal and the FilterRange inputs inside it. While exploring:
    • Requests that could change data (POST/PUT/PATCH/DELETE) are answered with fake data. They never reach a real backend.
    • Links, form-submit buttons and session-changing buttons (Log out, Pay, theme or language choices…) are never clicked. Menus that only offer those choices may be opened.
    • Every opener on the page is clicked first; then PictureCode goes one level deeper into the menus and dialogs they opened (row menu → Edit → edit dialog).
    • For anything that needs several steps, such as step 2 of a form, describe the steps in interactions (see below).
  3. On its own. A component that no page shows, for example a shared input or a widget not used anywhere yet, is rendered alone:
    • Vite (React, Vue or Solid). PictureCode opens the page where the component's parent is shown. It then mounts the component inside your app's live providers: every context provider on that path is read from the running React tree. That includes providers in App or a layout, UI-kit providers, React Query, router, i18n, Redux and themes, with no configuration needed. Vue uses the app context and the provide chain the same way.
    • Next.js (app or pages router, webpack or Turbopack). PictureCode writes a temporary page, picturecode-sandbox-…/page.tsx, in the folder of the page where the component appears, so the same layouts and providers wrap it. Async Server Components are rendered by a server page. The temporary pages are deleted when the capture ends (and on the next start, if VS Code was killed), and they're added to .git/info/exclude, so they never show up in git status.
    • Props are generated from its TypeScript props type. ReactNode becomes text, callbacks become no-ops, and objects with methods (a TanStack table, a form) get working fake methods.
    • Parts of compound components are rendered where they belong: DropdownMenuItem inside an open DropdownMenu and its DropdownMenuContent, SelectScrollDownButton inside a Select with 40 options, DialogTitle inside an open Dialog. "must be used within X" errors are read and X is added around the component, from the same file or anywhere in the project. Form parts get a react-hook-form provider.
    • Private components (declared in a file but not exported) are rendered from a copy of their file that exports them.
    • Its API calls are answered with data generated from your types.
    • Opened-up copies. When the component (or a part it renders) checks the user's role or permissions, or renders nothing because its data isn't there, it's rendered from a copy of its file in which data hooks (useUser(), useSession(), useSelector(…), useQuery(…), a zustand store, useContext(AuthContext)…) return what they returned completed with values generated from their return types (a user when there is none, isLoading: false, status: 'authenticated', empty lists filled, the most privileged member of a role union such as 'ADMIN' | 'USER'), permission checks answer yes, gate components pass their children through (<SignedOut> shows nothing), and withAuth(Page) is just Page. In Vite apps the copies are served in place of the originals while the picture is taken, so the components it renders open up too. Turn it off with "openUp": false.
    • This happens as soon as you open the file, and in the background after each full capture.

Components that render no visible UI (only <script>/<meta>, or just effects) are reported as such instead of getting an empty picture.

Signed in automatically. PictureCode finds where your app reads its session (localStorage['jwtToken'], a persisted auth store, Cookies.get('access_token')…) and seeds a fake signed-in session in its own headless browser, so pages behind auth guards get pictures. Login and register pages that redirect signed-in users are pictured signed out. Your own localStorage / cookies values in .picturecode.json win, and "autoLogin": false turns this off.

Where the pictures show up

Where What
In the minimap A small picture docked at the bottom of the minimap, inside its width. It shows the component at your cursor, or the whole page when the file is a page. Click it to open the full picture. With the minimap turned off, it sits left of the scrollbar. Toggle it with Ctrl/Cmd+Alt+P or the eye button in the editor title bar.
Full picture The whole page, with every component outlined and named (click one to open its file). Tabs switch between the page's states: With data, UI states such as Click "Filters", Loading, Empty data and API error.
PictureCode sidebar A larger preview with the component highlighted on its page, the same state tabs, and the list of every page it appears on. Tip: drag the view to the Secondary Side Bar (right side) to keep it beside your code.
Hover Hover a component name, such as <SearchHeader /> or an import, to see its picture.
CodeLens Each captured component gets a 📷 Preview · /search CodeLens above it.

Supported stacks

  • React 16–19, using the fiber tree. Source files come from _debugSource or _debugStack, with a name index as fallback. React Server Components (Next.js app router) are found through React 19's _debugInfo. This covers Vite, CRA, Next.js and Remix.
  • SolidJS dev builds (Vite + vite-plugin-solid, solid-refresh, lazy() routes, <Portal> content), through Solid's dev hooks. Components no page shows are rendered on their own inside the reactive owner where they're used, so router, query client, i18n and UI-kit contexts are there.
  • Vue 3, from component instances and __file. Svelte 4/5 dev builds, from __svelte_meta. Angular, from ng.getComponent in dev mode.
  • Routes are found in react-router objects and JSX, vue-router, Angular route arrays (including lazy loadChildren), TanStack createFileRoute, and Next.js app/ and pages/. Nuxt, SvelteKit, Astro and Remix/React Router file routes are found too. On top of that, PictureCode follows links on each page (crawling), and adds any routes you list.
  • Fake data comes from zod / valibot schemas, axios/ky/ofetch/fetch-style calls, Angular HttpClient (Observable<T>), generic wrappers (get<T>(url)), typed service functions ((): Promise<T>), and URL constants (URLS.SEARCH). URLs built with conditions ('/articles' + (feed ? '/feed' : '')) give every variant. This includes calls inside the <script> blocks of .vue and .svelte files.

Requirements

PictureCode drives a headless Chrome, Edge, Brave or Chromium that is already on your computer. If none is found, it offers to install Chromium (npx playwright install chromium), or you can set picturecode.browserPath.

Configuration

All settings live under picturecode.*. The ones you'll most likely change:

Setting Default
devServerUrl auto Force a URL instead of detecting one.
autoCapture onDevStartAndSave Or onDevStart, onOpen (large projects: no full capture, only the files you open and save), or manual.
mock.mode fallback always: never call the backend. off: never fake data.
routes / excludeRoutes Extra pages to capture, and pages to skip. /logout is always skipped.
explore.enabled, explore.maxClicksPerPage true, 20 Click buttons that open modals, menus and tabs.
sandbox.enabled, sandbox.maxPerRun true, 200 Render components that no page shows on their own.
viewport.width/height, deviceScaleFactor 1440×900, 1 Use 2 for sharp Retina pictures (about 4× the disk space).
viewport.device auto auto pictures mobile apps (Capacitor, Ionic, mini apps) at phone size, 390×844 2x. Or desktop / mobile.
dataStates.enabled true Also picture each page while loading, with empty lists, and with the API failing.
overlay.position minimap minimap: docked in the minimap, click to open. floating: the older card at the top right of the text area.
overlay.width, overlay.opacity 240, 0.96 Picture width when the minimap is off (or floating), and opacity.
storage extension project keeps pictures in .picturecode/ so you can commit and share them.

.picturecode.json (optional, per project)

Run PictureCode: Create .picturecode.json to get a starter file with schema validation. It covers what settings can't:

{
  "routes": ["/tickets/42", "/search?q=card"],
  "excludeRoutes": ["/admin/*"],
  // Seeded before your app boots: get past auth guards
  "localStorage": { "token": "fake-token", "user": { "id": 1, "role": "admin" } },
  "cookies": [{ "name": "session", "value": "abc" }],
  // Fixed responses win over generated ones
  "mocks": {
    "GET /api/me": { "id": 1, "fullName": "Alex Johnson" },
    "POST /tickets/search": { "status": 200, "body": { "items": [], "total": 0 } }
  },
  "waitForSelector": "[data-ready]",
  // UI that needs several steps to reach
  "interactions": [
    {
      "route": "/settings",
      "name": "Preferences · step 2",
      "steps": [
        { "click": "button:has-text('Edit preferences')" },
        { "click": "text=Continue" },
        { "wait": "text=Step 2" }
      ]
    }
  ],
  // Props for components rendered on their own (merged over the generated ones)
  "props": {
    "FilterRange": { "label": "Amount (TJS)", "min": 0, "max": 10000 }
  },
  // Set to false to stop PictureCode from clicking buttons
  "explore": true,
  // Set to false to stop PictureCode from signing in with a fake session
  "autoLogin": true,
  // Set to false to picture role-gated UI as it is for the fake session (no opened-up copies)
  "openUp": true
}

Steps use Playwright selectors: button:has-text('Filters'), [data-testid=open-filters], text=More, plain CSS. A step can click, hover, fill (["selector", "text"]), press a key, or wait (milliseconds or a selector).

Commands

PictureCode: Capture All Pages · Recapture Pages for Current File · Cancel Capture · Set Dev Server URL… · Open Picture Full Size · Toggle Minimap Picture · Delete All Captures · Show Log · Create .picturecode.json

Click the 📷 item in the status bar for a quick menu.

Development

npm install
npm run build            # bundles dist/extension.js, dist/analysis-worker.js and dist/cli.js
npm test                 # unit tests (set PC_FIXTURE=/path/to/app to also test type analysis)
npm run package          # type-checks and builds picturecode-x.y.z.vsix
node dist/cli.js <projectRoot> <devServerUrl> [outDir]   # headless capture, handy for CI

Press F5 in VS Code with a launch.json of type extensionHost to debug.

How it works

  1. Detect. Shell integration reads your dev command's output for the Local: URL. If that doesn't work, PictureCode probes your framework's default ports.
  2. Analyze (in a worker thread). The TypeScript compiler API finds HTTP calls and their response types, and turns each type into deterministic, realistic JSON. Property names guide the values: email, avatarUrl, createdAt, price, status, and so on. Pagination flags like hasNext are set to false so infinite loaders stop.
  3. Capture. A headless browser opens each route. Only fetch/XHR requests are intercepted; your dev server's modules are left alone, except that opened-up copies (role-gated UI) are served in place of the files they copy for the pictures that need them. PictureCode waits for the network to go quiet, fonts and lazy images to load, and animations to stop. Then it reads the component tree and takes a single screenshot.
  4. Slice. Component rectangles become WebP crops plus small thumbnails, all in the same browser. Nothing native ships with the extension.

Pictures stay on your machine. PictureCode only talks to your own dev server and to the backends your app already calls.

Known limits

  • VS Code has no API for drawing inside the minimap. The minimap picture is PictureCode's editor-title button ("open this picture full size") restyled with CSS anchor positioning so it sits on the minimap, which is why clicking it works. It needs VS Code 1.96 or newer (Chromium 125+); older builds and forks get the floating card. If you move editor actions out of the editor title bar (workbench.editor.editorActionsLocation), the picture is still shown but can't be clicked; use the sidebar or PictureCode: Open Picture Full Size.
  • Pages behind authentication are signed in with a fake session when PictureCode can see where the token is read from. If your app keeps it somewhere else (a constant key, an HTTP-only cookie set by a server), seed it in .picturecode.json.
  • Rendering a component on its own needs a Vite dev server (React, Vue or Solid) or Next.js. With other webpack setups (CRA) and Angular, components no page shows can only be reached through interactions.
  • A component that needs very specific props or context may fail to render alone. The sidebar then shows why, and you can give it props in .picturecode.json.
  • Opened-up copies need TypeScript types to generate data from; in plain JavaScript only permission checks and gates are opened up. In Next.js only the component's own file is copied (its children keep their checks).

Author

Made by Otajon Murodov (otajon.murodov.2002@gmail.com). Bugs and ideas: GitHub issues.

Released under the MIT License.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft