PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchFor Storybook, configure responsive screenshots with Chromatic’s Modes API: define viewport sizes in .storybook/modes.ts, then attach the modes to the stories or components whose responsive behavior you want to check. Each mode creates its own snapshot and approval baseline. Use Storybook viewport presets if your project already defines them.
Configure responsive viewports with Storybook Modes
Define named modes with explicit pixel dimensions, then apply only the modes relevant to each story or component. This keeps responsive coverage focused instead of creating extra snapshots for every story. See Chromatic’s Modes viewport guide and Story Modes documentation.
As an Amazon Associate I earn from qualifying purchases.
1. Define the viewport modes
// .storybook/modes.ts
export const allModes = {
mobile: { viewport: { width: 375, height: 812 } },
desktop: { viewport: { width: 1280, height: 900 } },
} as const;
These are example dimensions, not required device sizes. Chromatic accepts whole-number dimensions and integer strings with an optional px suffix. Its documented range is 200–2560 pixels for width or height.
2. Apply modes to the stories that need them
import { allModes } from '../.storybook/modes';
const meta = {
component: Example,
parameters: {
chromatic: {
modes: {
mobile: allModes.mobile,
desktop: allModes.desktop,
},
},
},
};
export default meta;
Attach the chromatic.modes parameter at story or component scope; project-level modes are also available. Because each applied mode produces a separate snapshot with its own baseline and approval, scope them to stories where layout changes matter. Chromatic says global assignment is not recommended in most cases.
#1 Best Overall
Reuse existing Storybook viewport presets
If your project already names viewport presets, define them in .storybook/preview.ts and reference their keys from the modes file. Storybook’s viewport options use dimensions in styles; Chromatic’s mode then selects the preset rather than repeating its dimensions.
// .storybook/preview.ts
export const parameters = {
viewport: {
options: {
mobile: {
name: 'Mobile',
styles: { width: '375px', height: '812px' },
},
desktop: {
name: 'Desktop',
styles: { width: '1280px', height: '900px' },
},
},
},
};
// .storybook/modes.ts
export const allModes = {
mobile: { viewport: 'mobile' },
desktop: { viewport: 'desktop' },
} as const;
Chromatic Modes do not accept every unit available to Storybook’s viewport feature: dimensions must be whole numbers or integer strings ending in px. Values such as rem and calc() are not supported as mode dimensions. Details and examples are in Chromatic’s viewport configuration guide.
Rank #2
Understand viewport size, capture height, and cropping
Chromatic documents a default viewport of 1200 × 900 pixels when no viewport is set. A width-only mode trims the capture to content height; a height-only mode uses a default width of 1200 pixels and trims to content width. A snapshot may contain at most 25,000,000 pixels.
Setting a viewport sizes the browser, but does not by itself clip a screenshot to the viewport’s height. By default, Chromatic captures the rendered UI’s full height. To clip it to the configured viewport height, set parameters.chromatic.cropToViewport: true. A root taller than the viewport can be clipped; a shorter root is captured only to its intrinsic height.
Rank #3
For unusually large captures, Chromatic documents a Safari and Firefox image-dimension limit of 32,767 pixels. At device pixel ratio 2.0, that limit is reached at half the CSS-pixel dimension; Chromatic says it automatically retries those captures at DPR 1.0. Consult the cross-runner viewport documentation when planning oversized snapshots.
Choose the right configuration scope and precedence
- Story or component modes: Best when only selected responsive layouts need review. Each configured mode creates an additional snapshot and baseline.
- Project-level modes: Available, but applying every viewport globally can multiply snapshots unnecessarily.
- Storybook viewport globals: These can control the Storybook canvas and may be respected by Chromatic. A story-level
chromatic.viewportor a mode that sets a viewport takes precedence. Non-pixel viewport globals are ignored. A story viewport can also be assigned throughglobals.viewport.value.
Use the current Modes API, not legacy viewports
The older parameters.chromatic.viewports setting is an array of widths. Chromatic describes it as replaced by Modes and says it plans to deprecate it. Chromatic converts legacy entries to modes during capture, but the legacy viewports and current modes APIs cannot be used at the same time. For a new setup, use Modes. See Chromatic’s legacy viewports page and its parameters and globals reference.
Configure viewport size in other supported test runners
Chromatic also documents runner-specific viewport settings. Use the setting for the runner executing the capture rather than assuming the Storybook configuration applies everywhere.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
- Vitest: Set the browser viewport in
vitest.configor callpage.viewport(width, height)at the test level. - Playwright: Configure
use.viewportin a project, or usetest.use({ viewport }). - Cypress: Set
viewportWidthandviewportHeightglobally or at test level. Chromatic’s current documentation sayscy.viewport()is unsupported for Chromatic capture.
Runner details are listed in Chromatic’s cross-runner viewport guide.
Best Value
Troubleshoot common viewport problems
- The capture is not clipped at the configured height: Viewport dimensions set the browser size; full rendered height is captured by default. Enable
parameters.chromatic.cropToViewport: trueif clipping is intended. - A mode dimension is rejected: Use whole-number pixel dimensions within Chromatic’s documented 200–2560-pixel range. Do not use
remorcalc()as mode dimensions. - Snapshots multiply unexpectedly: Each applied mode has a separate snapshot and baseline. Narrow the modes to stories or components that actually need responsive review.
- Legacy and current settings conflict: Do not combine
chromatic.viewportswithchromatic.modes; migrate to Modes. - A Cypress test’s viewport change is ignored: Chromatic documents
cy.viewport()as unsupported. ConfigureviewportWidthandviewportHeightin Cypress settings instead. - A very large snapshot fails or changes scale: Check the snapshot pixel total and browser image-dimension limits; Chromatic may retry affected Safari or Firefox captures at DPR 1.0.
Or skip the browser setup
If you need a website screenshot rather than Chromatic’s Storybook visual-test workflow, ScreenshotNeo can return an image or PDF from one request. For example, save a WebP screenshot of a page with cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. It removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.
Sign up for ScreenshotNeo’s free plan.
Frequently Asked Questions
Can I use a viewport width such as 320 pixels in Chromatic Modes?
No. Chromatic’s documented minimum width or height is 200 pixels, so 320 pixels is within range.
Does setting a Chromatic viewport automatically create a cropped screenshot?
No. Chromatic captures the rendered UI’s full height by default; enable cropToViewport to clip to the configured height.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




