use-cases/frontend-designs.md +128 −0 added
1# Build responsive front-end designs | Codex use cases
2
3[← All use cases](https://developers.openai.com/codex/use-cases)
4
5Copy page [Export as PDF](https://developers.openai.com/codex/use-cases/frontend-designs/?export=pdf)
6
7Use 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.
8
9Intermediate
10
111h
12
13Related links
14
15[Codex skills](https://developers.openai.com/codex/skills)
16
17## Best for
18
19 - Creating new front-end projects from scratch
20- Implementing already designed screens or flows from screenshots in an existing codebase
21
22## Skills & Plugins
23
24- [Playwright](https://github.com/openai/skills/tree/main/skills/.curated/playwright-interactive)
25
26 Open the app in a real browser to verify the implementation and iterate on layout and behavior.
27
28| Skill | Why use it |
29| --- | --- |
30| [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. |
31
32## Starter prompt
33
34Implement this UI in the current project using the screenshots and notes I provide as the source of truth.
35 Requirements:
36 - Reuse the existing design system components and tokens.
37- Translate the screenshots into this repo's utilities and component patterns instead of inventing a parallel system.
38 - Match spacing, layout, hierarchy, and responsive behavior closely.
39 - Respect the repo's routing, state, and data-fetch patterns.
40 - Make the page responsive on desktop and mobile.
41- If any screenshot detail is ambiguous, choose the simplest implementation that still matches the overall direction and note the assumption briefly.
42 Validation:
43- Compare the finished UI against the provided screenshots for both look and behavior.
44- Use $playwright-interactive to check that the UI matches the references and iterate as needed until it does.
45
46Implement this UI in the current project using the screenshots and notes I provide as the source of truth.
47 Requirements:
48 - Reuse the existing design system components and tokens.
49- Translate the screenshots into this repo's utilities and component patterns instead of inventing a parallel system.
50 - Match spacing, layout, hierarchy, and responsive behavior closely.
51 - Respect the repo's routing, state, and data-fetch patterns.
52 - Make the page responsive on desktop and mobile.
53- If any screenshot detail is ambiguous, choose the simplest implementation that still matches the overall direction and note the assumption briefly.
54 Validation:
55- Compare the finished UI against the provided screenshots for both look and behavior.
56- Use $playwright-interactive to check that the UI matches the references and iterate as needed until it does.
57
58## Introduction
59
60When 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.
61
62With 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.
63
64## Start from references
65
66Give 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.
67
68The 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.
69
70## Be specific
71
72The more specific you are about the expected interaction patterns and the style you want, the better the result will be.
73The 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.
74The 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.
75
76## Prepare the design system
77
78Codex 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.
79
80If 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.
81
82If 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.
83
84Ask 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.
85
86## Leverage Playwright
87
88Playwright 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.
89
90It can resize the browser window to different screen sizes and check the layout at different breakpoints.
91
92Make sure you have the Playwright interactive skill enabled in Codex. For more details, see the [skills documentation](https://developers.openai.com/codex/skills).
93
94## Iterate
95
96The first pass should already be directionally close to the screenshots. For complex layouts, interactions, or animation-heavy UI, expect a few rounds of adjustment.
97
98Ask 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.
99
100Use additional screenshots or short notes if they help clarify states that are not obvious from one image.
101
102### Suggested follow-up prompt
103
104[current implementation image] [reference image]
105This doesn't look right. Make sure to implement something that matches closely the reference:
106[if needed, specify what is different]
107
108## Related use cases
109
110[
111
112### Turn Figma designs into code
113
114Use Codex to pull design context, assets, and variants from Figma, translate them into code...
115
116Front-end Design](https://developers.openai.com/codex/use-cases/figma-designs-to-code)[
117
118### Generate slide decks
119
120Use Codex to update existing presentations or build new decks by editing slides directly...
121
122Data Integrations](https://developers.openai.com/codex/use-cases/generate-slide-decks)[
123
124### Add iOS app intents
125
126Use Codex and the Build iOS Apps plugin to identify the actions and entities your app should...
127
128iOS Code](https://developers.openai.com/codex/use-cases/ios-app-intents)