# Viewports (legacy)
> chromatic.viewports feature is now being replaced by the new Modes API
URL: https://chromatic.com/docs/legacy-viewports
# Viewports (legacy Storybook API)
🚨 The chromatic.viewports feature is now replaced by the new Modes API. With Modes, you can test your stories in various viewports and customize global settings. Additionally, you have the flexibility to define specific viewport heights for testing purposes.
To transition to the new API, please consult the migration guide.
UI components can respond to device width. Chromatic makes it easy to visual test these cases with the `viewports` parameter. This helps you define one or more viewport sizes to capture. Using viewports requires Storybook 4.0 or later.
## Viewports for a story
To set a viewport, specify one or more screen _widths_ to the `chromatic.viewports` [parameter](https://storybook.js.org/docs/writing-stories/parameters#story-parameters):
```ts title="MyComponent.stories.ts|tsx"
// Adjust this import to match your framework (e.g., nextjs, vue3-vite)
import type { Meta, StoryObj } from "@storybook/your-framework";
import { MyComponent } from "./MyComponent";
const meta = {
component: MyComponent,
title: "MyComponent",
} satisfies Meta