Flexbox help

Hi all, I’ve got a problem centring something with flexbox:


The green shows the area of the component. On it is a flexbox contains 3 items in a column. Each item is fixed with a .maxWidth() and I’m trying to centre the buttons across the parent component, but whatever settings I put (alignContent,alignItems,justifyContent) the items are always fixed left.

Any ideas?


I would try and replicate it with a web based Flexbox learning tool first (e.g. https://www.learnflexbox.org) and then see if the JUCE implementation behaves the same, or if it’s a problem in your code.

Posting your code might help too :wink:

Not sure what exactly you are trying to achieve here, I’m also no FlexBox expert, but did you set the flex direction correctly?

Have you tried setting alignSelf to AlignSelf::center on each of the individual FlexItems?

1 Like

hi, thx for the suggestions guys - will take a look over the weekend - i think the web based tool should be a help!