npx twiddle-panel init

Tweak a prototype’s design system live, then share the exact version.

Panel is a small tool you drop into any HTML prototype. Expose type, colour, shape, density and depth as knobs. Reviewers explore them, copy a link to what they like, and hand the result to a coding agent.

This page runs Panel. Open it with the Panel button in the bottom-right corner (or press Alt T) and change anything: these docs restyle as you go.

Step 1

Install

Run the setup command, let your coding agent set it up, or add it yourself. All four load the same panel.

Run this in your prototype’s folder. It finds the right file (your app’s entry file, or index.html for a plain page) and shows the line to add. It changes nothing yet.

Terminal
npx twiddle-panel init

Happy with it? Run it again with --write to add the line for you. It never adds it twice.

Terminal
npx twiddle-panel init --write

With a build tool it loads the panel only while developing (the tokens stay in every build). Add --always to load it in every build too, for shared preview links, or --file path/to/file to choose the file yourself. With a build tool it reminds you to run npm install -D twiddle-panel. For Next.js it prints a small client component to paste instead. Needs Node.js.

Step 2

Style with tokens

The panel changes the --twd-* CSS variables. Anything you style with them responds to the panel; anything with fixed values stays as it is. Let your coding agent convert your styles, or write them yourself.

Paste this into Claude Code, Cursor or any agent working on your prototype. It replaces fixed values with tokens and keeps your current look as the starting point.

Prompt
Convert this prototype's styles to use the Panel design tokens (the --twd-* CSS custom properties from twiddle-panel), so the panel can tweak them live.

1. Keep the current look. In a :root rule loaded after twiddle-tokens.css, set each token below to the value this project already uses (for example, if buttons use #0f766e, set --twd-primary: #0f766e). Only set the tokens the project actually needs.
2. Replace fixed values in component styles with var(--twd-…). Map each value to the closest token by role:
   - Fonts: --twd-font-heading, --twd-font-body
   - Text sizes: --twd-text-xs, -sm, -base, -lg, -xl, -2xl, -3xl; line height: --twd-leading-tight, --twd-leading-normal
   - Font weights: --twd-weight-heading (headings, big numbers), --twd-weight-strong (buttons, labels, emphasis)
   - Colours: --twd-bg (page), --twd-surface (cards, inputs), --twd-surface-raised (menus, popovers), --twd-text, --twd-text-muted, --twd-border, --twd-primary, --twd-primary-hover, --twd-on-primary (text on primary), --twd-focus, --twd-success, --twd-warning, --twd-danger
   - Buttons, inputs, chips: --twd-radius-control, --twd-control-height, --twd-control-pad-x
   - Cards, menus, modals: --twd-radius-container, --twd-border-width-container
   - Main button and default card, preferred where they fit: --twd-button-bg, --twd-button-fg, --twd-button-border, --twd-button-hover (hover background); --twd-card-bg, --twd-card-border, --twd-card-shadow
   - Borders: --twd-border-width
   - Spacing (padding, margin, gap): --twd-space-1 to --twd-space-8 (4, 8, 12, 16, 24, 32, 48, 64px)
   - Layout roles, preferred where they fit: --twd-page-pad (side padding of the page), --twd-section-gap (between page sections), --twd-card-pad (inside cards, menus, modals), --twd-card-gap (between items in a card), --twd-control-gap (between buttons, chips, inputs in a row)
   - Shadows: --twd-shadow-sm, --twd-shadow-md, --twd-shadow-lg
3. Leave values that don't match a role as they are (layout widths, one-off illustrations, icon sizes). Don't invent new --twd-* tokens.
4. Don't change the layout or how the page looks; after the change it should look the same until someone uses the panel.
5. When done, list the files you changed and any values you left fixed, with the reason.

See the token reference for the full list.

Step 3

Use the panel

Open it with the Panel button in the bottom-right corner, or Alt T (Option T on a Mac). The panel opens beside the button, and short messages such as “Link copied” appear just above it. Tabs along its top switch between areas; one row along its bottom holds the actions for the whole page. Try it on this sample:

Sample components

Select one of these with Pick (the arrow) to change it on its own.

ControlWhat it does
Overview tabThe Character pad: drag up for spacious, down for compact; left for Subtle, right for Bold (font weights, borders, corners and shadows). Below it, a summary of the current look; each row opens its tab.
Colour tabPick one of four themes, then fine-tune with the Tailwind palette: a colour family and shade for the primary, a grey family for the neutrals. A custom hex still works. Mode switches Light and Dark.
Type tabFont pairings, base size and scale.
Spacing tabDensity. Layout roles points page padding, section gaps, card padding and similar roles at a different spacing step.
Shape tabButtons: Style (Solid, Soft, Outline, Ghost), corners and size. Cards: Style (Filled, Outlined, Elevated, Tinted), corners, Fill (None, Surface, Raised, Tinted) and borders.
Shadows tabShadow style and intensity.
… tokensEach tab ends with its tokens as rows, so you can set any one exactly. A token you set by hand is marked Custom and stays put when you move the broad knobs; reset it to undo that.
Linked settingsTabs stay in step. When the Character pad changes something another tab owns (corners, borders, shadows, weights), that tab shows the real value and says “from Character”. Spacing between two presets reads, for example, “Between Regular and Comfy”.
Pick (arrow)Starts selection mode: click an element, and every tab (the Character pad included) now changes just that element, until you press Pick again. Switch to All .class to change every element like it.
Compare (half circle)Hold it, or press Alt C, to see the original page.
Copy linkCopies a link to this exact version. Settings live in the ?twd= part of the address.
ResetBack to the page’s own defaults. Undo brings it back.
MoveDrag the Panel button anywhere: it settles into the nearest corner and keeps its distance from the edges, and the panel opens on the side away from the edge. With the button focused, the arrow keys nudge it 1px (Shift for 10px). Double-click it to put it back in the bottom-right corner. Your spot is remembered on that site.
Minimise (chevron)At the end of the tabs. Shrinks the panel to just its tabs, beside the Panel button. Click a tab or the chevron to open it again. The Panel button closes the panel altogether.
Undo / RedoIn the bottom row, or ⌘ Z / ⇧ ⌘ Z while the panel has focus.
Changes (count)The number in the bottom row. Opens a side panel next to the main one, listing every tweak with the token values before and after. Remove any one with ×.

To decide what “all like this” means for an element, add data-twd="name" to it. Panel groups by that name instead of the class.

Step 4

Hand off to your agent

Tweaks in the panel live only in the link. To make them permanent, press Copy prompt. Panel writes a prompt for your coding agent (Claude Code, Cursor or similar) that lists:

  • token changes for the whole page, old value → new value
  • changes for every element sharing a class
  • single-element changes, described so the agent can find them
  • any colour pairs that fail WCAG AA contrast

Paste it into the agent working on your prototype. Use the arrow next to Copy prompt to choose between Preview before copying and Copy without preview.

The panel is a design tool. Load it while developing or in shared prototype links, not in a production site.

Token reference

Every --twd-* token, its default, and the panel section that changes it
TokenDefaultWhere in the panel
--twd-font-heading, --twd-font-bodySystem sansType › Fonts
--twd-text-xs … --twd-text-3xl0.694rem … 2.074rem (1.2 scale)Type › Base size, Scale
--twd-leading-tight, --twd-leading-normal1.2, 1.5Type › Type tokens
--twd-weight-heading (headings, big numbers), --twd-weight-strong (buttons, labels, emphasis)600, 600Overview › Character (Subtle ↔ Bold); Type › Type tokens
--twd-primary, --twd-primary-hover, --twd-on-primary, --twd-focus#4f46e5, #4338ca, #ffffff, #6366f1Colour › Theme, Primary
--twd-bg, --twd-surface, --twd-surface-raised#fafafa, #ffffff, #ffffffColour › Theme, Neutral, Mode
--twd-text, --twd-text-muted, --twd-border#18181b, #71717a, #e4e4e7Colour › Theme, Neutral, Mode; Overview › Character (Bold darkens muted text and borders)
--twd-success, --twd-warning, --twd-danger#16a34a, #d97706, #dc2626Colour › Colour tokens
--twd-radius-control8pxShape › Buttons › Corners; Overview › Character
--twd-control-height, --twd-control-pad-x40px, 16pxShape › Buttons › Size; the padding also under Spacing › Layout roles
--twd-radius-container12pxShape › Cards › Corners; Overview › Character
--twd-border-width, --twd-border-width-container1pxShape › Cards › Borders (cards); Overview › Character
--twd-button-bg, --twd-button-fg, --twd-button-border, --twd-button-hover (main button)primary, on-primary, transparent, primary-hoverShape › Buttons › Style
--twd-card-bg, --twd-card-border, --twd-card-shadow (default card)surface, border, shadow-smShape › Cards › Style, Fill
--twd-space-1 … --twd-space-84, 8, 12, 16, 24, 32, 48, 64pxOverview › Character (up/down); Spacing › Density
--twd-page-pad (side padding of the page)space-5 (24px)Spacing › Layout roles
--twd-section-gap (between page sections)space-6 (32px)Spacing › Layout roles
--twd-card-pad (inside cards, menus, modals)space-5 (24px)Spacing › Layout roles
--twd-card-gap (between items in a card)space-2 (8px)Spacing › Layout roles
--twd-control-gap (between buttons, chips, inputs in a row)space-3 (12px)Spacing › Layout roles
--twd-shadow-sm, --twd-shadow-md, --twd-shadow-lgSoft shadowsShadows › Style, Intensity; Overview › Character

Troubleshooting

The panel opens, but nothing on my page changes

Your CSS uses fixed values. Replace them with var(--twd-…) tokens (see step 2).

The Panel button doesn’t appear

Check that the script or import runs: with a build tool, the import.meta.env.DEV check only passes on the dev server. Then press Alt T in case the panel is closed.

A picked element lost its tweaks after I changed the page

Single-element tweaks find the element by its position in the page. Give it an id or a data-twd name before tweaking, so it can be found again.