to-grid

generate an array of elements split into groups in specified layout