use-cases/frontend-designs.md +153 −0 added
1# Build responsive front-end designs | Codex use cases
2
3Codex use cases
4
5
6
7
8
9Codex use case
10
11# Build responsive front-end designs
12
13Turn screenshots and visual references into responsive UI with visual checks.
14
15Difficulty **Intermediate**
16
17Time horizon **1h**
18
19Use Codex to translate screenshots and design briefs into code that matches the repo's design system, then use Playwright to compare the implementation to your references for different screen sizes and iterate until it looks right.
20
21## Best for
22
23 - Creating new front-end projects from scratch
24- Implementing already designed screens or flows from screenshots in an existing codebase
25
26# Contents
27
28[← All use cases](https://developers.openai.com/codex/use-cases)
29
30Copy page [Export as PDF](https://developers.openai.com/codex/use-cases/frontend-designs/?export=pdf)
31
32Use Codex to translate screenshots and design briefs into code that matches the repo's design system, then use Playwright to compare the implementation to your references for different screen sizes and iterate until it looks right.
33
34Intermediate
35
361h
37
38Related links
39
40[Codex skills](https://developers.openai.com/codex/skills)
41
42## Best for
43
44 - Creating new front-end projects from scratch
45- Implementing already designed screens or flows from screenshots in an existing codebase
46
47## Skills & Plugins
48
49- [Playwright](https://github.com/openai/skills/tree/main/skills/.curated/playwright-interactive)
50
51 Open the app in a real browser to verify the implementation and iterate on layout and behavior.
52
53| Skill | Why use it |
54| --- | --- |
55| [Playwright](https://github.com/openai/skills/tree/main/skills/.curated/playwright-interactive) | Open the app in a real browser to verify the implementation and iterate on layout and behavior. |
56
57## Starter prompt
58
59Implement this UI in the current project using the screenshots and notes I provide as the source of truth.
60 Requirements:
61 - Reuse the existing design system components and tokens.
62- Translate the screenshots into this repo's utilities and component patterns instead of inventing a parallel system.
63 - Match spacing, layout, hierarchy, and responsive behavior closely.
64 - Respect the repo's routing, state, and data-fetch patterns.
65 - Make the page responsive on desktop and mobile.
66- If any screenshot detail is ambiguous, choose the simplest implementation that still matches the overall direction and note the assumption briefly.
67 Validation:
68- Compare the finished UI against the provided screenshots for both look and behavior.
69- Use $playwright-interactive to check that the UI matches the references and iterate as needed until it does.
70
71Implement this UI in the current project using the screenshots and notes I provide as the source of truth.
72 Requirements:
73 - Reuse the existing design system components and tokens.
74- Translate the screenshots into this repo's utilities and component patterns instead of inventing a parallel system.
75 - Match spacing, layout, hierarchy, and responsive behavior closely.
76 - Respect the repo's routing, state, and data-fetch patterns.
77 - Make the page responsive on desktop and mobile.
78- If any screenshot detail is ambiguous, choose the simplest implementation that still matches the overall direction and note the assumption briefly.
79 Validation:
80- Compare the finished UI against the provided screenshots for both look and behavior.
81- Use $playwright-interactive to check that the UI matches the references and iterate as needed until it does.
82
83## Introduction
84
85When you have screenshots, a short design brief, or a few references for inspiration, Codex can turn those into responsive UI without ignoring the patterns already established in your project.
86
87With the Playwright skill, Codex can open the app in a real browser, compare the implementation to your screenshots for different screen sizes, and iterate on layout or behavior until the result is closer to the target.
88
89## Start from references
90
91Give Codex the clearest references you have for the UI you want. A single screenshot can be enough for a narrow task, but the handoff gets better when you include multiple states such as desktop and mobile layouts, hover or selected states, and any empty or loading views that matter.
92
93The references do not need to be perfect design deliverables. They just need to make the intended hierarchy, spacing, and direction concrete enough that Codex is not guessing.
94
95## Be specific
96
97The more specific you are about the expected interaction patterns and the style you want, the better the result will be.
98The model tends to default to high-frequency patterns and style so if it's not obvious from your references that you want something else, the UI might look generic.
99The more input you give, be it more reference inspiration or more specific instructions, the more you can expect to have a UI that stands out.
100
101## Prepare the design system
102
103Codex works best when the target repo already has a clear component layer. Codex can automatically use your existing component and design system instead of recreating them from scratch.
104
105If you think it's necessary (i.e. if you're not using a standard stack), specify to Codex which primitives to reuse, where your tokens live, and what the repo considers canonical for buttons, inputs, cards, typography, and icons.
106
107If you're starting from an existing codebase, it's very likely that Codex will understand on its own how to use your components and design system, but if starting from scratch, it's a good idea to be explicit.
108
109Ask Codex to treat the screenshots as a visual target but to translate that target into the project's actual utilities, component wrappers, color system, typography scale, spacing tokens, routing, state management, and data-fetch patterns.
110
111## Leverage Playwright
112
113Playwright is a great tool to help Codex iterate on the UI. With it, Codex can open the app in a real browser, compare the implementation to the screenshots you provided, and iterate on layout or behavior.
114
115It can resize the browser window to different screen sizes and check the layout at different breakpoints.
116
117Make sure you have the Playwright interactive skill enabled in Codex. For more details, see the [skills documentation](https://developers.openai.com/codex/skills).
118
119## Iterate
120
121The first pass should already be directionally close to the screenshots. For complex layouts, interactions, or animation-heavy UI, expect a few rounds of adjustment.
122
123Ask Codex to compare the implementation back to the screenshots, not just whether the page builds. When conflicts come up, it should prefer the repo's design-system tokens and only make minimal spacing or sizing adjustments needed to preserve the overall look of the design.
124
125Use additional screenshots or short notes if they help clarify states that are not obvious from one image.
126
127### Suggested follow-up prompt
128
129[current implementation image] [reference image]
130This doesn't look right. Make sure to implement something that matches closely the reference:
131[if needed, specify what is different]
132
133## Related use cases
134
135[
136
137### Turn Figma designs into code
138
139Use Codex to pull design context, assets, and variants from Figma, translate them into code...
140
141Front-end Design](https://developers.openai.com/codex/use-cases/figma-designs-to-code)[
142
143### Generate slide decks
144
145Use Codex to update existing presentations or build new decks by editing slides directly...
146
147Data Integrations](https://developers.openai.com/codex/use-cases/generate-slide-decks)[
148
149### Add iOS app intents
150
151Use Codex and the Build iOS Apps plugin to identify the actions and entities your app should...
152
153iOS Code](https://developers.openai.com/codex/use-cases/ios-app-intents)