Copy-ready prompts for UX and web work. Fill in the [brackets], then check what you get back.
Build components
Ask AI to build interface parts you can test in a browser.
Generate an interactive button
Act as a senior front-end engineer who cares about accessible design. Build an interactive button component for [product or brand] using [HTML, CSS and vanilla JavaScript / React / Vue].
Look and feel: [describe the style, for example calm, rounded corners, brand colour #800020, 16px text]. Use CSS custom properties for colour, radius, spacing and animation timing so I can change them in one place.
Variants: primary, secondary and text-only. Sizes: small, medium and large, with a touch target of at least 44 by 44 px.
States and events:
- Hover: [for example the background darkens and the button lifts 1px], with a 150 ms transition.
- Focus: a clear 2px outline with an offset, shown for keyboard users and never removed.
- Pressed: scales to 0.98 while the mouse or finger is down.
- Click: [what should happen, for example show a spinner for 1.5 seconds, then a check mark and the label Saved, then return to normal]. Ignore extra clicks while it is loading.
- Disabled: lower contrast but still readable, no hover effect, and set aria-disabled.
Requirements: works with mouse, touch and keyboard (Enter and Space), meets WCAG 2.2 AA contrast, respects prefers-reduced-motion, and announces loading and success to screen readers with aria-live.
Output: one code block per file, no external libraries, comments only where the behaviour is not obvious. Finish with a short list of the design decisions and any assumptions you made.
Sample prompt
Act as a senior front-end engineer who cares about accessible design. Build an interactive button component for a meditation app using HTML, CSS and vanilla JavaScript. Look: calm, rounded, brand colour #2f6f5e, 16px text. Hover: the background darkens and the button lifts 1px. Click: show a spinner for 1.5 seconds, then a check mark and the label Saved, then return to normal. Include primary, secondary and text variants, and all the accessibility requirements above.
Fill in the brackets, then open the result in a browser and tab through it with the keyboard.
AI tools can be wrong, biased or out of date. Verify what they tell you, never paste private or confidential data, and treat research output as a starting point: it does not replace talking to real users.