Closing The Design-To-Code Gap With Flexbox
Flexbox is the backbone of most modern web layouts. It is how elements get stacked into rows and columns, aligned, and distributed across a page. Yet in typical design-to-development workflows, designers build static mockups that developers then reinterpret into Flexbox code — a translation step where details get lost and time gets burned.
Penpot, an open-source design tool built on open web standards, tackles this with Flex Layout. It lets designers compose layouts visually using the same rules CSS Flexbox follows, then hand off designs that are already production-ready code. The result: less guesswork for developers, more control for designers, and a smoother overall process.
What Flex Layout Gives You
A Flex Layout works like an array of elements. You define the direction of that array — left-to-right, right-to-left, top-to-bottom, or bottom-to-top — and then control how the elements within it align against each other.
Beyond simple alignment, you can manage how elements sit inside their containers, letting you fine-tune spacing and distribution the way you would in CSS.
Flex layouts can wrap across multiple lines, and because they can be nested indefinitely, you can build layouts as simple or as intricate as the project demands.
That is only the start. Flex Layout also gives you access to properties like z-index for controlling element stacking order, along with per-element ordering control — capabilities that most design tools simply do not expose.
Working Through A Practical Example
To see Flex Layout in action, it helps to walk through a concrete UI example.
Take buttons first. With Flex Layout, you can make a button responsive to the size of its icon and label, set internal padding, and define spacing between child elements — all without hand-coding anything.
Avatar stacks are another good use case. Overlapping images is simply a matter of applying a negative gap between elements. And since Penpot supports z-index, you keep full control over which avatar sits on top.
Because Flex layouts nest, you can build a navbar and a tiles grid as separate, self-contained layouts and then combine them into a larger structure. When a layout needs to respond to its parent container, wrapping handles that: blocks fill both vertically and horizontally just as CSS would lay them out.
Not every element belongs in a flex flow, though. Penpot also supports absolute positioning, so you can pull an element out of the flex layout — say, an “Edit” button — while keeping it in the same container, ignoring the layout rules.
Finally, you can make the entire board itself a Flex Layout. The design becomes fully fluid, and testing responsiveness is as simple as resizing the board to see how the components adapt.
Getting Started And Going Further
If you want to experiment with these features, Penpot provides a dedicated Flex Layout template that walks through every option with examples and definitions. You can duplicate it from the Penpot site and start building right away.
The source file for the example layout described above is also available for duplication, so you can inspect exactly how each piece was put together.
For help along the way, the Penpot Community forum is the place to ask questions, and a video tutorial is available that demonstrates how designers and developers can collaborate using Flex Layout.
What Is Next: CSS Grid Support
Flexbox alone is not enough for every layout. More complex designs often depend on CSS Grid, and the two work best together. Penpot does not support CSS Grid yet — but that is changing. At the upcoming Penpot Fest, the team plans to share details and a demo of the forthcoming Grid Layout feature, so there is more to look forward to on the horizon.



