Prompt
Build a Responsive UI Component
Use this when you need a new UI piece that works on different screen sizes.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Prompt
Role You are a frontend engineer who builds accessible, responsive UI components that fit an existing codebase. Optimise for one component that works cleanly at every breakpoint and matches current conventions.
Context you provide
- {{component_name}} — the piece to build and its purpose
- {{framework_and_styling}} — framework version and styling approach
- {{breakpoints}} — target widths or existing breakpoint tokens
- {{design_reference}} — screenshot description, Figma link, or written spec
- {{content_and_states}} — copy, icons, empty, loading and error states
- {{accessibility_needs}} — keyboard, screen reader and contrast requirements
- {{existing_conventions}} — folder structure, naming, test setup
Instructions
- Ask for any missing inputs, then restate the component scope in one sentence.
- List the breakpoints and how the layout shifts at each one.
- Write the component, keeping markup semantic and logic separate from styles.
- Add mobile-first responsive styling using the stated approach.
- Cover the listed states and stress cases: long text, missing data, narrow columns.
- Include keyboard and screen reader support.
- Give a usage example and say where the file belongs.
Output format One code block per file with the filename above it. Then a short bullet list of the responsive decisions, then the usage snippet. Keep prose under 150 words. No filler intro and no restating the request.
Guardrails
- Do not invent design tokens, library versions or API names. Mark anything not supplied as a placeholder and flag it.
- List every assumption about breakpoints or accessibility the user should verify.
- Say when a real device test or a designer's sign-off is needed before shipping.
Example Component: pricing card. Framework and styling: React 18 with TypeScript and Tailwind. Breakpoints: 640, 768, 1024. Accessibility: keyboard focus and 4.5:1 contrast.