### Hierarchy

- Diagram
  - Palette

Palette extends the Diagram class to allow objects to be dragged and placed onto other Diagrams. Its Diagram.layout is a GridLayout. The Palette is Diagram.isReadOnly but to support drag-and-drop its Diagram.allowDragOut is true.

For more discussion, see Introduction to Palettes. See samples that make use of Palettes in the samples index.

You can control the order of Parts in the palette in several manners:

- If you want to keep the order given by `myPalette.model.nodeDataArray`, just set `myPalette.layout.sorting = go.GridLayout.Forward` (GridLayout.sorting).
- If you want to sort based on some text string associated with each Part, just bind Part.text.
- If you want to sort more generally, set `myPalette.layout.comparer` (GridLayout.comparer).

## Index

### Constructors

- constructor

## Constructors

### constructor

- new Palette(div?: string | Element, init?: Partial<Palette>): Palette
- new Palette(init?: Partial<Palette>): Palette

- #### Parameters

  - ##### Optional div: string | Element

    A reference to a DIV HTML element or its ID as a string. If no DIV is supplied, a Palette will be created in memory. The Palette's Diagram.div property can then be set later on.

  - ##### Optional init: Partial<Palette>

    A JavaScript object specifying optional initialization properties object. Can specify Palette properties, and Palette sub-properties such as `"undoManager.isEnabled": true`, Example:

        {
          allowZoom: false,
          "animationManager.isEnabled": false
        }

  #### Returns Palette

- #### Parameters

  - ##### Optional init: Partial<Palette>

    A JavaScript object specifying optional initialization properties object. Can specify Palette properties, and Palette sub-properties such as `"undoManager.isEnabled": true` Example:

        {
          allowZoom: false,
          "animationManager.isEnabled": false
        }

  #### Returns Palette

Copyright © 1998-2021 by Northwoods Software Corporation.