Restyle a UI component to match a reference design
Refactor a component's markup, styles, and accessibility to match a design-system reference while keeping its props, state, and logic intact.
The prompt
Help me restyle an existing UI component to match a reference component, without changing what it does.
My component: [PASTE the full source]
Framework and styling: [e.g. React + Tailwind, Vue + CSS modules]
Reference to match: [PASTE the reference component's source, or describe it - e.g. a component from my design system or a UI library]
Things that must not change: [props interface, data fetching, event handlers, analytics calls, test IDs]
Work in this order:
1. Analyze my component first - list its props and types, internal state, side effects, context it uses, events it emits, and any test selectors. Confirm this list before changing code.
2. Analyze the reference - structure, class names or tokens, variants, animations, and accessibility attributes (roles, aria-*, keyboard behavior, focus states).
3. Map old to new - a table of each element in my component and its equivalent in the reference; note anything with no equivalent.
4. Refactor the visual layer only - markup, classes, animations, accessibility. Keep the props interface and logic identical.
5. Check behavior - keyboard navigation, focus visibility, screen reader labels, reduced-motion support, dark mode, responsive sizes.
Return: the analysis, the mapping table, the updated component code, a short diff summary, and a checklist of what to test manually. If a reference behavior conflicts with existing logic, stop and ask rather than changing the logic.
Highlighted [brackets] are blanks to replace with your own details.
Fill in the blanks and use this promptMore Software Development prompts
What to fill in
- PASTE the full source
- e.g. React + Tailwind, Vue + CSS modules
How this prompt is built
This prompt follows the Few-Shot structure (Few-shot prompting). A few-shot prompt includes one or more worked examples of the input and the output you want, so the model can copy the pattern instead of guessing it.
Related prompts
- Diagnose slow launches and API cold starts in my mobile appA codebase-specific diagnosis of startup time, serverless cold starts, and network waste, with fixes ranked by impact on perceived speed.
- Get a beginner-friendly code review of my first projectA ranked set of the five improvements that matter most, explained simply, plus what you did well and what to learn next.
- Review every change since my last release before shippingA pre-release review of all changes since a tag: missing translations, simplifications, breaking changes, security, and a draft changelog.
- Audit the developer experience of my software package or APIA structured review of your docs, onboarding, community signals, and competitor position, with a prioritized list of developer-experience fixes.