Build a Button and Form Field States Reference Sheet in a Single HTML File

Get a polished, single-file reference sheet that shows button and text field states side by side, with a live playground and contrast ratios computed from design tokens.

You getone complete HTML file in a single code block, then 3 short ideas to extend it.

The prompt

Prompt
You are a senior product designer who also writes clean, accessible front-end code. Build "Statewise", a one-page states reference sheet for the fictional Harbor design system. It should show how buttons and form fields look in every interaction state.

At the top, add a state matrix. Use rows for primary button, secondary button and text input. Use columns for default, hover, focus-visible, active, disabled, loading and error. End the matrix with a spec row that names the tokens used in each state.

Rules:
1) Render each forced state with CSS classes that mirror the real pseudo-class styles. Make matrix samples non-focusable.
2) Below the matrix, add a live playground with Save changes (shows a 1.5-second spinner, then a timestamped status), Cancel, and a Publish button that stays disabled until both fields are valid. Include an email field that validates on blur, and a workspace-name field with a fake availability check that rejects "harbor".
3) Define a small palette as CSS custom properties: navy ink, one blue accent, one red for errors, and neutral grays.
4) Compute WCAG contrast ratios in JavaScript from those properties. Show a swatch card per color pair with the ratio and an AAA, AA, AA large, non-text 3:1, Fail or Exempt badge.
5) Focus uses a 3px gap plus a 3px ring. Errors pair color with an icon and text. Status messages use a polite live region.
6) Fit widths from 360 to 1280px. On narrow screens the matrix scrolls sideways with a sticky label column. Respect prefers-reduced-motion. Use no external resources, form elements or storage.

Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.

Example output

One HTML file. Save it and open it in any browser.Open full screen

Example: Statewise, a states reference sheet for the Harbor design system.

The top matrix shows primary buttons, secondary buttons and an email field in seven states, with token notes underneath. In the playground:

  • Tab through the controls to see focus rings.
  • Press Save changes to watch the loading state.
  • Type a broken email and leave the field to trigger an inline error.
  • Enter harbor as the workspace name to see the taken-name error.

Publish unlocks once both fields are valid. The contrast cards list live WCAG ratios.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Forced-state classes mirror real pseudo-classes, so the matrix and the live playground always share one set of styles.
  • Contrast is computed from the CSS custom properties, so changing a token updates every ratio and badge automatically.
  • Concrete behaviors (1.5s spinner, a reserved taken name, Publish gated on validity) give the model testable targets instead of vague polish.

Paste the prompt into ChatGPT, Claude or Gemini. Save the returned code as statewise.html and open it in any browser, or view it in the chat's preview or canvas panel.

Common edits

  • Swap the token hex values and rename Harbor to match your own design system; the contrast badges recalculate automatically.
  • Add more rows, such as a checkbox, a select or a toggle switch, each with the same seven state columns.

Prompt details

By
Prompts-GPT editors
Published
How prompts are written and checked

Did this prompt work?

Keep exploring

More in Design