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