This is an extension and not part of the main GoJS library. Note that the API for this class may change at any time. If you intend to use an extension in production, you should copy the code to your own source directory. Extensions can be found in the GoJS kit under the `extensions`, `extensionsTS` (UMD modules), or `extensionsJSM` (ES6 modules) folders. See the Extensions intro page for more information.

### Hierarchy

- PanelLayout
  - PanelLayoutFlow

A custom PanelLayout that arranges panel elements in rows or columns. A typical use might be:

    $(go.Node,
      ...
      $(go.Panel, "Flow",
        ... the elements to be laid out in rows with no space between them ...
      )
      ...
    )

A customized use might be:

    $(go.Node,
      ...
      $(go.Panel,
        $(PanelLayoutFlow, { spacing: new go.Size(5, 5), direction: 90 }),
        ... the elements to be laid out in columns ...
      )
      ...
    )

The direction property determines whether the elements are arranged in rows (if 0 or 180) or in columns (if 90 or 270).

Use the spacing property to control how much space there is between elements in a row or column as well as between rows or columns.

This layout respects the GraphObject.visible, GraphObject.stretch, and GraphObject.alignment properties on each element, along with the Panel's Panel.defaultStretch, Panel.defaultAlignment, and Panel.padding properties.

If you want to experiment with this extension, try the Flow PanelLayout sample.

## Index

### Constructors

- constructor

### Properties

- direction
- spacing

### Methods

- arrange
- measure

## Constructors

### constructor

- new PanelLayoutFlow(): PanelLayoutFlow

- Constructs a PanelLayoutFlow that lays out elements in rows with no space between the elements or between the rows.

  #### Returns PanelLayoutFlow

## Properties

### direction : number

- Gets or sets the initial direction in which elements are laid out. The value must be 0 or 180, which results in rows, or 90 or 270, which results in columns.

  The default value is 0, resulting in rows that go rightward. A value of 90 results in columns that go downward.

  Setting this property does not notify about any changed event, nor does a change in value automatically cause the panel layout to be performed again.

### spacing : Size

- Gets or sets the space between adjacent elements in the panel and the space between adjacent rows or columns.

  The default value is (0, 0). The size is in the panel's coordinate system.

  Setting this property does not notify about any changed event, nor does a change in value automatically cause the panel layout to be performed again.

## Methods

### Override arrange

- arrange(panel: Panel, elements: GraphObject[], union: Rect): void

- #### Parameters

  - ##### panel: Panel

  - ##### elements: GraphObject[]

  - ##### union: Rect

  #### Returns void

### Override measure

- measure(panel: Panel, width: number, height: number, elements: GraphObject[], union: Rect, minw: number, minh: number): void

- #### Parameters

  - ##### panel: Panel

  - ##### width: number

  - ##### height: number

  - ##### elements: GraphObject[]

  - ##### union: Rect

  - ##### minw: number

  - ##### minh: number

  #### Returns void

Copyright © 1998-2021 by Northwoods Software Corporation.