
- Updated
Build a React component from a description
Describe the component, its data and how it should behave, and this prompt writes one self-contained React component with TypeScript, accessible markup and a mobile layout, plus a usage example.
Act as a senior frontend developer using [STACK, e.g. React with TypeScript and Tailwind]. Component: [WHAT IT IS, e.g. a pricing table with monthly and yearly toggle] Props and data: [DESCRIBE] Behaviour: [e.g. yearly shows 2 months free, highlights the middle plan] Style: [e.g. clean, rounded cards, works on mobile] Write one self-contained component with typed props, accessible markup, keyboard support and a mobile layout. Keep state minimal. Add a small usage example and list any assumption you made.
Paste an existing component from your project and say "match this style" for code that fits in.
Get a better result
One self-contained React component with typed props, accessible markup, keyboard support and a mobile layout, minimal state, a short usage example and a list of the assumptions it made.
The prompt splits the spec into props, behaviour and style, which are the three things a developer would ask you about before writing code. Naming your stack gets TypeScript and Tailwind code rather than plain JavaScript and CSS. Asking for listed assumptions is the safety net: it shows where the model filled a gap, so you can catch it early.
The component fetches its own data.
Fix: Say the data comes in through props, so the component stays easy to test and to reuse on another page.
- The toggle is a div with a click handler. Ask for a real button or radio group with a visible focus state, so it works with the keyboard and screen readers.
- The styling clashes with your project. Paste one existing component and ask it to match it, as the tip says.
Ask for how the component looks while data loads, when the list is empty and when something fails.
Some of your assumptions are wrong: [CORRECTIONS]. Update the component to match and list anything else you had to change.
More chat & writing prompts
See all 465 →More like this
- Check a UI component for accessibilityClaude · ChatGPT · Gemini
- Act as my customer and react to my offerChatGPT · Gemini · Claude
- Learn a new framework using one you knowClaude · ChatGPT · Gemini
- Write a regex from a plain descriptionChatGPT · Gemini · Claude
- Clean a messy spreadsheet with PythonClaude · ChatGPT · Gemini



