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
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
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
Keep exploring
More like this
Build a Color Blindness Simulator That Previews a Palette on a Dashboard Card
A single HTML file that redraws a realistic dashboard card under protanopia, deuteranopia, tritanopia and grayscale and flags color pairs that become hard to tell apart.
Build a Drag-to-Arrange Brand Mood Board with Color, Texture and Type Tiles
A prompt that produces a single HTML mood board of color, texture and type tiles built from CSS and SVG, rearrangeable by mouse, touch and keyboard.
Build a Draggable Color Harmony Wheel With Live UI Preview in One HTML File
A ready-to-paste prompt that builds a draggable canvas color wheel. It plots complementary, triadic and analogous schemes live and previews each one on a mini website mockup.
Build a Light/Dark Mode Toggle Demo Page with Smooth Theme Switching
A single HTML page with a polished light/dark theme switch built on CSS custom properties that defaults to the system theme, honors reduced motion, and uses no storage.
Build a Live Accessible Color Palette Builder with a WCAG Contrast Matrix
Get a single HTML palette builder that tests every text-on-background pair, shows AA/AAA badges live, and suggests the nearest passing shade for failures.
Build a Multi-Step Onboarding Wizard with Stepper and Inline Validation
A four-step onboarding wizard in one HTML file, with a clickable stepper, progress bar, inline validation, a review screen, and keyboard and swipe navigation.
- Build a Playful Animated 404 Error Page with SVG Art and Site Search
- Build a Responsive Navigation Bar With Mega Menu and Mobile Drawer in HTML
- Build a Responsive Three-Tier Pricing Section with Monthly/Yearly Toggle
- Build a Testimonial and Logo Social-Proof Section in a Single HTML File
- Build an Accessible Modal, Toast and Tooltip Showcase in One HTML File
- Build an OKLCH Tint and Shade Scale Generator in a Single HTML File