mwg API
    Preparing search index...

    Function flowLayout

    • Lays items out left to right and wraps to a new row when the next one would pass width: a toolbar that takes one row on a desktop and two on a phone. An item wider than width sits alone on its row rather than being dropped.

      Parameters

      Returns FlowResult

      import { flowLayout } from '@datamoc/mwg/two-d/ui';

      const buttons = [{ width: 120, height: 32 }, { width: 120, height: 32 }, { width: 120, height: 32 }];
      const { positions, height } = flowLayout(buttons, 300, { gap: 8, align: 'center' });
      console.log(positions.length, height); // 3 buttons on two rows: 72