Work with layers in draw.io

Layers add structure and organisation to your diagrams. When you interact with a complex diagram, to display or hide its various layers, you can understand them more easily.

Note: Each shape or connector (or group) can only be placed on one layer - it can’t belong to multiple layers.

Using layers in diagrams

The sections below explain how to work with layers in draw.io.

Tip: Open the example gitflow in the draw.io editor - use the sections below to learn how to work with these layers in a diagram.

You can also learn how the .drawio file format works with layers

Open the Layers dialog

Select View > Layers or press Ctrl+Shift+L / Cmd+Shift+L to display or hide the Layers dialog.

Select View > Layers to open the Layers dialog

By default, a new diagram has a single Background layer, to which all shapes, connectors and text are added.

From the Layers dialog, you can add new layers and rename them, select which layer to add new shapes to, remove existing layers, and move selected shapes to a layer.

You can also display and hide layers, which will display or hide all the shapes, connectors and text that are on those layers.

Finally, locking a layer makes sure you can’t make any inadvertent changes.

Add a new layer

At the bottom of the Layers dialog, click on Add Layer (+).

Your new layer will be automatically selected (with a blue background), and any new shapes you add to the drawing canvas will be placed on your new layer.

Click on Add Layer (+) in the Layers dialog to add a new layer

Duplicate a layer: Select the layer you want to duplicate, then click on the Layers menu (three horizontal lines) and select Current Layer > Duplicate.

Select a layer then click on Duplicate (overlapping box) in the Layers dialog to duplicate it

Back to top

Rename a layer

When you add a new layer, it will be given a default name. Start typing immediately to change its name to something meaningful. Double click on any layer to edit its new name at any time, or open the Layers menu and select Current Layer > Rename.

Double click on a layer, and enter a new name

Rename a layer via its metadata

Layers have metadata, just like shapes have metadata. This metadata allowed advanced functionality within your You can also change a layer’s name via the Edit Data dialog.

See how to use metadata and placeholders in labels and tooltips

  1. Select a layer, then click on the Layers menu (three horizontal bars) and select Current Layer > Edit Data.
    Select a layer in the Layers dialog, then click on Edit Data
  2. Change the text in the Label field and click Apply to change the layer’s name.
    In the Edit Data dialog for that layer, change the label text and click Apply to rename it

Back to top

Remove a layer

Removing a layer will delete all the shapes and connectors that are on it as well as the layer itself. Click on a layer to select it, then click on Delete in the bottom of the Layers dialog (rubbish bin) to remove the layer and its shapes.

Select a layer, then click on the rubbish bin icon to remove it and all the shapes/connectors it contains

Note: Your diagram must have at least one layer for shapes and connectors to be placed. If there is only one layer in your diagram, you can not delete it.

Back to top

Work with shapes on layers

Shapes are arranged in the order you added them to the drawing canvas, within the layer you added them.

Layers are arranged from front to back as they are ordered top to bottom in the Layers dialog. Shapes and connectors placed on a higher layer can not go behind shapes on a lower layer - they can only be arranged from front to back within their layer.

Add shapes to a layer

  1. Make the layers are visible and unlocked before you make changes (click on the eye to display a hidden layer and the lock icon to the left of the layer name). Layers are unlocked by default.
  2. Select the layer you want to add the shape to in the Layers dialog, then add the shape to the drawing canvas.

Make the layer you want to add the shape or connector to visible and unlocked, then select it, and add your shape/connector

Back to top

See which layer a shape belongs to

Select one shape or more shapes - make sure they are all on the same layer. Note the dot to the right of the layer name - this shows that your selected shape(s) are on that layer.

Select a shape, note the dot on the right of the layer name - this is the layer the shape belongs to

Note: If you have selected shapes on different layers, you will not see a dot in the Layers dialog.

Back to top

Move shapes to another layer

  1. Select the shapes, connectors and text you want to move to another layer.
  2. In the layers dialog, click on the three horizontal lines (Layers Menu), then Move Selection to and click on the layer you want to move your selected shapes to.

Move the selected shapes to another layer via the Layers dialog

The dot indicating on which layer your selected shapes are will be updated to your choice.

Back to top

Rearrange layers to move shapes forward or backward

To move one layer’s shapes in front of another, you need to change the order of the layers in the Layers dialog. Layers are arranged from top to bottom (front to back on the drawing canvas).

Learn how the z-order of shapes positions them in front of or behind other shapes

Click and drag a layer in the Layers dialog to place its shapes in front of or behind another layer.

In the Layers dialog, drag a layer higher or lower to move its contents above or below shapes and connectors on the other layers

Note: When you move shapes to a layer, they are placed in front of any existing shapes on that layer, just like when you add new shapes to a layer.

Alternatively, select a layer, open the Layers dialog menu, click on Current Layer and choose to move the layer forwards or backwards. Move the selected layer in front or or behind other layers via the Layers dialog
See how layers work with z-order in draw.io

Back to top

Hide or display layers

To understand complex diagrams that use layers, you can display and hide layers.

In the Layers dialog, click on the eye on the left of layer’s name to display or hide the layer.

Click on the eye next to the layer name to display or hide the shapes and connectors on that layer

Hide or display layers in the diagram viewer: Click on the Layers tool at the bottom of the diagram viewer, then click on the eye icons next to the layer names to hide or display the layers. This tool is not available if the diagram only has one layer.

Click on the layer tool then on the eyes next to layer names to hide or display them in the diagram viewer

Tip: Use custom links to make your diagram interactive and toggle layers on and off when you click on a shape within the diagram.

Back to top

Lock layers to prevent changes

Locking a layer means you cannot make any changes to it - you can’t add, move, edit, style or delete the shapes and connectors placed on that layer.

In the Layers dialog, click on the padlock icon to the left of the layer’s name that you want to lock.

Click on the padlock next to a layer's name in the Layers dialog to lock or unlock the layer

Back to top

Select objects in a layer

  1. Select a layer in the Layers dialog.
  2. In the Layers dialog menu, select Current Layer > Select Objects in Layer.

This does not select shapes and connectors inside any container shapes or groups in that layer. In the example below the Container shapes and brackets in the Service layer are selected, but the shapes inside those containers are not. They will still move and be copied along with their container.

Select the objects in the current layer selects any container shapes or groups, but does not select any objects inside those containers/groups

See how layers, shapes and connectors are organised inside the .drawio diagram format.

Diagrams that work well with layers