Skip to content

Change flex direction, after the flex container wraps #8153

@manuelmeister

Description

@manuelmeister

I often come across the requirement to grow a flex item, but only If the flex container wraps:

Two states: 1. single line wide flex container with space between the two items. 2. two lines and both flex items grow to full width

Usually this comes up with buttons (e.g. submit & cancel) that should be full width, if they are not on one line.

Both currently possible "workarounds" are not desired:
Two possible but not desired workarounds: 1. Flex grow on the items at all times/breakpoints. 2. Non-grow flex items, one on the left and one on the right on a separate line

Also if there are more than two items. Then it should wrap as well.
Bildschirmfoto 2022-11-30 um 10 15 39

I think one way to solve this could be:

flex-wrap: wrap-column;
/* or probably better */
flex-wrap: wrap-direction;

This would make the direction of the flex container change upon wrap.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions