Identify the flex container and items, follow their axes, and predict when a line can wrap.
Three controls in a toolbar need to stay together as their labels change length. Flexbox lets the browser arrange a group of items along one axis and share space between them.
The element with display: flex becomes a flex container. Its in-flow child elements become flex items. If a control contains an icon and a label, the control is one item in the toolbar. The icon and label keep their own internal layout unless the control also establishes a layout for them.
The main axis runs in the direction the items are laid out. The cross axis runs across it. The initial flex direction is a row, so in horizontal, left-to-right text the controls run from left to right. Changing the direction to a column makes the main axis run from top to bottom in this writing mode.
Start with enough space to fit all three controls on one row. Make the toolbar narrower. By default Flexbox keeps one line, and the controls can shrink until their size limits intervene. If they reach those limits, content can overflow.
Enable flex-wrap with the value wrap and a control that no longer fits can start a new line. If two controls still fit together, the third can move below them. Each line then shares its own available space. This distinction will matter when you size and align the items.
Try it yourself
HTML + CSS