Skip to content

flex-shrink: 0 prevents adjacent element from resizing to maintain 100% row width #870

@HungTonQuantalytix

Description

@HungTonQuantalytix

Hi,

Thank you for your great library!

I'm using it in a project where I need to support dynamic resizing for multiple elements in a single row. These elements share a common parent with width: 100%, and their combined width should always remain 100%.

For example, if I have two elements with widths of 40 and 60, and I resize the first element to 30, I want the second element to automatically expand to 70 — keeping the total width at 100.

To achieve this, my approach is:

When resizing an element, I want the adjacent element (either the next or previous one, depending on which side is being dragged) to take up the remaining space.

For a smoother experience, I use CSS to apply flex-grow: 1 and flex-shrink: 1 to the adjacent element.

However, I noticed the library sets flex-shrink: 0 by default, which prevents the adjacent element from resizing properly. I can override this with !important, but I wanted to ask:

Is there a specific reason flex-shrink: 0 is enforced? Would modifying it to allow shrinking/growing cause any issues or break core functionality?

Thanks so much in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions