Flex Shrink

The flex-shrink property in CSS determines how a flex item shrinks relative to the rest of the items in a flex container when there isn't enough space.

Flex Shrink in Workmaster

In Workmaster, the Flex Shrink property controls how a widget contracts when the parent Flex Container has less space than required.

Possible Values

Value
Description

0 (default)

The widget will not shrink, even if there isn’t enough space.

1 or higher

The widget will shrink proportionally with other flex items based on their shrink values.

Examples

Initial Layout with Three Widgets

Consider a Flex Container with three widgets that exceed the total available width of the container.

Items 2 and 3 exist but are outside the visible canvas.

1. Flex Shrink: 0

  • Widget A: Flex Shrink: 0

  • Widget B: Flex Shrink: 0

  • Widget C: Flex Shrink: 0

All widgets retain their original width, causing overflow outside the container if necessary.

Items 2 and 3 exist but are outside the visible canvas.

2. Flex Shrink: 1

  • Widget A: Flex Shrink: 1

  • Widget B: Flex Shrink: 1

  • Widget C: Flex Shrink: 1

Widgets shrink equally to fit inside the container without overflowing.


3. Mixed Flex Shrink Values

  • Widget A: Flex Shrink: 2

  • Widget B: Flex Shrink: 1

  • Widget C: Flex Shrink: 1

Widget A shrinks twice as much as Widgets B and C, minimizing its width more significantly.

Last updated