Just use flex-wrap: wrap on the flex container to force the content to a new line, and make the title and the button fixed width to not leave any space for the content if the title is present.
flex-wrap: wrap
https://codepen.io/Lubomyr-Pryt/pen/EaxBGNy