fluid.size_lock

Size locking allows placing restrictions on the size of a node. Using the SizeLock node template, one can set limits on the maximum size of a node.
Normally, nodes default to using the least space they can: the bare minimum they need to display correctly. If their Node.layout.align property is set to fill, they will instead attempt to use all of the space they're given. Using SizeLock allows for a compromise by placing a limit on how much space a node can use.

Note

Using layout!"fill" with SizeLock will negate the lock's effect. Use a different alignment like "start", "center" or "end".
Size limit can be used to center content on a wide screen. By using sizeLock!node, .layout!"center" and .sizeLimitX, we can create space around the node for comfortable reading.
import fluid;

sizeLock!vframe(
    .sizeLimitX(400),       // Maximum width of 800 px
    .layout!(1, "center"),  // Use excess space to center the node
    label(
        "By using sizeLock and setting the right limit, a node can be "
        ~ "forced to use a specific amount of space. This can make your "
        ~ "app easier to use on a wide screen, without affecting smaller "
        ~ "windows or displays."
    ),
);