Flex
Forms that use flex, and the gui.layouts.flex, horizontalFlex and verticalFlex builders,
still work: a flex layout renders as a grid. Move them to grid the next time you edit the form.
gui.layouts.horizontalFlex([cancel, save], { gap: 8, align: 'end' });gui.layouts.verticalFlex([name, email]);gui.layouts.horizontalGrid([cancel, save], { gap: 'sm', justify: 'end' });gui.layouts.grid([name, email]);{ "kind": "layout", "type": "flex", "props": { "direction": "row", "gap": 8, "align": "end" }}{ "kind": "layout", "type": "grid", "props": { "direction": "row", "gap": "sm", "justify": "end" }}From flex to grid
Section titled “From flex to grid”This is how a flex layout renders today, and what to write instead:
| Flex | Grid |
|---|---|
type: 'flex', direction: 'column' or none | type: 'grid' |
type: 'flex', direction: 'row' | type: 'grid', direction: 'row' |
row-reverse, column-reverse | Not supported: they render in source order. Reorder the children |
gap in pixels | gap, a step from 'none' to 'xl'. Pixels become the nearest step |
align | justify. space-around and space-evenly become space-between |
justify | Nothing: the grid lines up the fields’ labels, controls and errors |
a child’s size | The same size, in a row |
gui.layouts.horizontalFlex(…) | gui.layouts.horizontalGrid(…) |
gui.layouts.flex(…), verticalFlex(…) | gui.layouts.grid(…), verticalGrid(…) |
The reversed directions render in source order because, with them, screen readers and the keyboard went through the fields in a different order from the one on screen.
The .gui-flex classes are gone too: a flex layout renders the
grid’s markup. The
migration guide lists the other layout changes of 2.0.