Any width

Drag the edge, or pick a width: the same playground wraps and scrolls inside its box, never the page.

Framework decisions behind it: D33, D34.

A playground works at any width. Its toolbar and tabs wrap, long code scrolls inside the editor, and wide outputs scroll in their own box. The page itself never scrolls sideways.

A frame you resize

Drag the frame's bottom-right corner, or pick a width. The playground follows the frame, not the screen. Widths are in CSS pixels.

Width of the frame

Frame width: full px

// A long line scrolls inside the editor. It is not wrapped, so indentation stays readable, and it never widens the page. const squares = Array.from({ length: 24 }, (_, i) => (i + 1) ** 2); console.log(squares.join(", "));

In a narrow column

On a wide screen, the same playground can sit beside text. It follows its own width, so it is as tidy in a 288 pixel column as in a full page. On a narrow screen the column drops below the text.

A sidebar, a chat panel and a documentation margin are all narrow places for code. The toolbar wraps onto a second line, the tabs wrap, and the editor scrolls along its long lines.

// A long line scrolls inside the editor. It is not wrapped, so indentation stays readable, and it never widens the page. const squares = Array.from({ length: 24 }, (_, i) => (i + 1) ** 2); console.log(squares.join(", "));

Touch

With a coarse pointer, such as a finger, every control is 44 pixels tall and code is 16 pixels or larger, so that iOS does not zoom in when you focus the editor. Open this page on a phone to see it.

The page's part

A page needs <meta name="viewport" content="width=device-width, initial-scale=1">. A flex or grid item that holds a playground needs min-width: 0, or the item grows to the width of the longest line and the page scrolls sideways.