UI developer interview questions and how to answer them
UI developer interview questions test how faithfully and robustly you turn a design into working interface code: CSS layout and the cascade, responsive behavior, semantic and accessible markup, reusable components built on design tokens, and motion that stays smooth. Expect a design-to-code exercise from a mockup, questions about component APIs and design systems, and a review of how you work with designers on details.
By Evin JohnPublished 7 min read
What a UI developer is hired to do
A UI developer sits between design and application engineering. They take screens and specs from a design tool, build them as components that match the design across screen sizes, states and browsers, and make sure keyboard and screen reader users can use them. On many teams they also maintain the component library and the design tokens (colors, spacing, type) that keep a product consistent.
Compared with a frontend developer, the loop spends less time on data fetching, state management and frontend system design, and more on CSS, accessibility and visual detail. Compared with a UI designer, you are judged on code, not on the visual decisions themselves, though you are expected to notice when a design will not hold up in a real browser. Some companies use the title for a general frontend role, so read the posting for the balance.
How UI developer interviews usually run
- Recruiter screenYour stack, the products you have built UI for, links to live work or a portfolio, and how closely you have worked with designers.
- Technical screenQuestions on HTML semantics, CSS, JavaScript basics and accessibility, sometimes with a short live exercise in a shared editor.
- Design-to-code exerciseBuild a component or small page from a mockup: a pricing card, a navigation bar, a modal, a form with errors. Done live or as a take-home.
- Component and system roundDesign the API of a reusable component, discuss how you would structure tokens and themes, or review existing UI code for problems.
- Collaboration roundHow you handle design feedback, ambiguous specs, edge cases the designer did not draw, and disagreements about feasibility.
CSS and layout questions
| Question | What it tests | What a strong answer shows |
|---|---|---|
| How does specificity work, and how do you keep it low? | The cascade | The order of inline, ID, class and element weight, plus single-class selectors, cascade layers or scoped styles to avoid specificity wars |
| When do you choose Grid and when Flexbox? | Layout judgment | Grid for two-dimensional page or card layouts, Flexbox for one-dimensional alignment inside a component, and both together |
| Why is my z-index not working? | Stacking contexts | A new stacking context from transform, opacity, position with z-index or isolation, and how to inspect it |
| How do you make type scale smoothly between breakpoints? | Fluid sizing | clamp() with a rem minimum and maximum, so text respects user font settings |
| What are container queries and when would you use them? | Modern CSS | Styling a component by its container's size, which suits reusable cards better than viewport media queries |
| How do you stop layout shift when images load? | Stability | Width and height attributes or aspect-ratio, reserved space for late content, and font loading strategies |
| What is the difference between em, rem, px and viewport units? | Units | Relative to parent font size, root font size, fixed, and viewport size, with when each fits |
| How do custom properties differ from preprocessor variables? | Theming | Custom properties live at runtime, cascade and can change per theme or component, while preprocessor variables compile away |
:root {
--space-2: 0.5rem;
--space-4: 1rem;
--radius-md: 0.75rem;
--color-surface: #ffffff;
--color-text: #1a1a1a;
}
.card-wrap { container-type: inline-size; }
.card {
display: grid;
gap: var(--space-4);
padding: var(--space-4);
border-radius: var(--radius-md);
background: var(--color-surface);
color: var(--color-text);
}
.card__title { font-size: clamp(1.125rem, 1rem + 1vw, 1.5rem); }
@container (min-width: 32rem) {
.card { grid-template-columns: 10rem 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
.card { transition: transform 150ms ease-out; }
.card:hover { transform: translateY(-2px); }
}Be ready to explain each line: why spacing comes from tokens, why the layout responds to the container rather than the viewport, why the motion only runs for people who have not asked the system to reduce it, and why the animation uses transform, which browsers can usually animate without recalculating layout.
Accessibility and semantics questions
- Build a button that opens a menu. Which element do you use? A real button element, with aria-expanded reflecting state and the menu items reachable by keyboard. A clickable div needs far more work to reach the same behavior.
- What does a modal dialog need to be accessible? A label, focus moved inside on open, focus kept inside while open, Escape to close, focus returned to the trigger, and the page behind made inert. The native dialog element covers much of this.
- When should you use ARIA? When native HTML cannot express the role or state. Wrong ARIA is worse than none, so prefer semantic elements first.
- How do you check color contrast? Measure it against WCAG contrast ratios for text and interface parts, including hover, focus and disabled states, in every theme.
- How do you make form errors usable? Visible text near the field, linked with aria-describedby, announced when they appear, and not shown by color alone.
- How do you test with assistive technology? Keyboard-only passes, a screen reader on at least one platform, browser zoom to 200 percent, and automated checks as a first filter rather than the final word.
- What is a visible focus indicator and why not remove outlines? Keyboard users need to see where they are. Style focus-visible to fit the design instead of removing it.
Components and design system questions
| Question | What it tests | What a strong answer shows |
|---|---|---|
| Design the API for a Button component. | API design | A small set of variants and sizes, native attributes passed through, loading and disabled states, no props for one-off styles |
| How would you structure design tokens? | Systems thinking | Base values, semantic tokens such as color-text-danger that reference them, and component tokens only where needed |
| How do you support light and dark themes? | Theming | Semantic custom properties swapped per theme, tested contrast in both, and respect for the user's system preference |
| How do you document components? | Developer experience | An isolated workshop such as Storybook with states, usage guidance, and accessibility notes |
| How do you catch visual regressions? | Quality | Screenshot comparison in CI on key components and states, reviewed like any other diff |
| A product team wants to override your component's styles. What do you do? | Governance | Understand the need, add a variant if it is common, and keep escape hatches narrow and documented |
Design collaboration and craft questions
- The mockup shows a desktop layout only. What do you do? Ask the designer for intent at small sizes, propose a version, and confirm before building it widely.
- The design uses a font weight the product does not load. How do you raise it? Show the cost and the alternatives, and agree a choice rather than quietly substituting.
- How do you handle states the designer did not draw? List them early: empty, loading, error, long text, many items, right-to-left languages, and agree on the treatment.
- How do you check your build against the design? Compare at real sizes, test with real content, and review together with the designer before merge.
- How do you keep animations smooth? Animate transform and opacity, avoid animating layout properties, measure in the browser's performance tools, and honor reduced-motion settings.
- What is your approach to browser support? Follow the agreed support list, use progressive enhancement, and check feature support before relying on newer CSS.
Fictional example
- Candidate
- Our checkout form looked right in the design file but failed in practice: errors appeared only in red, the date field was three dropdowns, and on small phones the pay button fell below the keyboard.
- Candidate
- I rebuilt it with the designer. Errors became text linked to each field and announced to screen readers, the date became a single input with a clear format, and the layout used the dynamic viewport height so the button stayed reachable.
- Candidate
- We tested it with keyboard only, with a screen reader and on three phones. Support tickets about the form dropped noticeably in the following month, and the patterns went into our component library.
Behavioral questions
- Tell me about a time you pushed back on a design for technical or accessibility reasons.
- Describe a component you built that other teams adopted.
- Give an example of a visual bug that reached production and what you changed afterward.
- Tell me about working with a designer whose specs were incomplete.
Answer with one concrete story each, in the shape described in the behavioral question guide. Teams hiring UI developers like stories where a detail you caught made the product better for real users.
A two-week preparation plan
- Days 1 to 4: rebuild three components from real products (a card, a navigation bar, a dialog) from screenshots, with no framework, then again in the framework the posting names.
- Days 5 to 7: review CSS fundamentals: cascade and specificity, stacking contexts, Grid, Flexbox, container queries, logical properties and clamp().
- Days 8 to 10: practice accessibility: keyboard patterns for menus, tabs and dialogs, form errors, contrast checks and a screen reader pass on your own work.
- Days 11 and 12: write a short design-token structure and a component API for a button and an input, and explain your choices aloud.
- Days 13 and 14: prepare portfolio walkthroughs and questions about the design system, the design-to-dev process and how UI quality is reviewed.
For practice, Natively is an AI interview assistant for Mac and Windows that can read a mockup or coding prompt from a screenshot and talk through an approach, transcribe your mock session on your computer, and save notes so you can see where your explanation of a layout went vague. Adding your résumé and the job description (Pro or the free trial) keeps its suggestions tied to your real projects.
Questions people ask
What questions are asked in a UI developer interview?
Expect CSS questions on specificity, Grid and Flexbox, stacking contexts and fluid sizing, accessibility and semantic HTML, component and design token design, a build from a mockup, and questions on working with designers.
What is the difference between a UI developer and a frontend developer?
A UI developer focuses on turning designs into accessible, responsive components and maintaining the design system. A frontend developer usually covers more application logic, state, data fetching and frontend architecture.
How do I prepare for a design-to-code interview?
Rebuild real components from screenshots, cover every state such as empty, error and long text, test with keyboard and a screen reader, and practice explaining your layout and markup choices aloud.
Do UI developer interviews include JavaScript?
Usually yes, at the level needed for interactive components: events, DOM updates, focus management and the framework named in the posting. The deepest questions tend to be on CSS and accessibility.
Where to go next
Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.
Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.
