Complete AI Training

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

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. 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

  1. Ask for any missing inputs, then restate the component scope in one sentence.
  2. List the breakpoints and how the layout shifts at each one.
  3. Write the component, keeping markup semantic and logic separate from styles.
  4. Add mobile-first responsive styling using the stated approach.
  5. Cover the listed states and stress cases: long text, missing data, narrow columns.
  6. Include keyboard and screen reader support.
  7. 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.