Draw and style connectors in draw.io

draw.io 30 Mar 2021

Share:

Connectors are lines that connect your shapes together and may or may not have arrows at one or both ends. In a diagram, connectors provide context information, showing how the various shapes and entities in your diagram are related.

Connectors are used to group related information and systems, show flow of information and control, and specify the complex relationships between functions and systems in UML diagrams.

Tip: Connectors are also known as lines or edges. Some of the properties in draw.io that affect connectors use the term ‘edge’ when defining connector styles.

Floating and fixed connectors

There are two main types of connectors in draw.io.

Floating connectors - These move around the perimeter of your shapes as you move them around the drawing canvas, or change the route that the connector takes.

Fixed connectors - These stay attached to fixed points on your shapes, even when you move the shapes around the drawing canvas.

Floating connectors move intelligently around the shape when you move it. Fixed connectors stay attached to that fixed point on the shape.

Connectors can be fixed and one end and floating at the other, or the same type of connection at both ends.

You can change a shape’s style to only allow connectors to attach to connection points. When you move the shape, the connector will snap to the nearest connection point.

Draw connectors between shapes

While there are a number of connector shapes available in the shape libraries, it is easier to draw connectors between shapes on the drawing canvas, then style them as you need.

There are several different ways you can draw connectors in draw.io.

Draw a floating connector: Hover over an existing shape, click and drag a connector from one of the four directional arrows and hover over the target shape. Drop the connector end when the shape outline is blue. You’ll see the end of the connector turn blue with a circle to indicate it’s a floating connection.
Floating connector - Drop the connector on the target shape when the outline is blue

Draw a fixed connector: Hover over a shape to see the fixed connection points. Click and drag a connector from one of these points - a cross highlighted in green - and hover over the target shape. Drop the connector end over a fixed connection point when it is highlighted in green. You’ll see the end of the connector turn green with a cross to indicate it’s a fixed connection.
Fixed connector - Drop the connector on a connection point - a small x - when it is highlighted with a green circle

Fixed connection points are usually spaced evenly around the outside of a shape. You can override this and change a shape’s style to have custom connection points.

You can fix the end of a connection to any location within a shape: Hold down Alt as you drag the connector into position over the target shape, then drop the connector when you see a green outline on the shape (indicating a fixed connection point).
Hold down Alt key as you connect to a shape to connect to any position on that shape

Tip: If the target shape is directly above/below or to the right/left of the source shape, hover over the source shape, then click on the arrow pointing towards the target shape to quickly connect the two.

Join connectors

Use the waypoint shape in the Misc shape library to join connectors instead of overlapping them. Drop connectors onto or drag connectors from the waypoint shape, just as you would any other shape.

Add connectors automatically when you add a new shape

When you add new shapes to the drawing canvas, draw.io can automatically add connectors between them.

Clone and connect a shape: Hover over a shape and click on a direction arrow towards a blank space on the drawing canvas, then select a shape to add and connect it in that direction.
Clone and connect by hovering over a shape and clicking on the blue arrows

Drag and drop a shape: Drag a shape from the shape library or the drawing canvas, hover over another shape and drop it on one of the direction arrows (or an existing unconnected connector).

Drag and drop shapes onto the blue directional arrows or connector ends

See how to use shortcuts to add and connect shapes, and clone and connect shapes

Add labels to a connector

Connectors can have three labels - one in the middle, and at either end.

Double click on the connector at the location where you want to add a label.

These labels will move with the connector as you move the shapes around on the drawing canvas, but you can also drag them to another location. Select the label by clicking on it, then drag the diamond grab handle to a new position.

Connectors can have three labels - double click to add a label to a connector, and drag the labels to a new position using the diamond grab handle.

Tip: When you reverse a connector, the labels at the source and target ends are also swapped.
Reverse a connector via the Arrange tab of the format panel

Move the path of a connector

Connectors use waypoints to follow a path through your diagram.

Drag parts of the connector into a new position to make it take a different route. Waypoints are added and removed automatically as you drag them into new positions.

Drag a connector to add waypoints

If you want to add extra waypoints manually, right-click on the connector, then select Add Waypoint from the context menu.

Learn more about working with waypoints

Reverse a connector: Swap the target and source ends of a connector along with their labels via the Arrange tab in the format panel.

Flip a connector: Flip a connector horizontally or vertically via the Arrange tab in the format panel. The path that a connector takes through its waypoints will be changed, which may have unintended consequences where the connector is attached to shapes.
Flip a connector horizontally or vertically via the Arrange tab of the format panel

Style connectors

The default connector style is a solid line with an arrow head at the target end.

Just like you can change a shape’s colour and outline, you can change a selected connector’s colour and line style, and set the ends of a connector to have an arrow or another symbol, using the options in the Style tab of the format panel on the right.

The Style tab in the format panel and the connector tools in the tool bar let you change the style of a selected connector in draw.io

Here is how the various connector styles appear in a diagram in the editor.

Sharp/rounded/curved - this changes how the ‘bends’ in a connector appear, whether there is a sharp or slightly rounded corner when it changes direction, or a smooth curve.
Style your connector using the options in the Style tab in the format panel on the right in draw.io

Colour - Click on the colour button next to the line style to open the palette and choose a different colour for the connector.
Style your connector using the options in the Style tab in the format panel on the right in draw.io

Connection - Use the top-left drop-down list to choose how the line appears - a single solid line, a double line, or two style of ‘thick’ arrows. Drag the diamond grab handles on a selected double-line connector to change the size of the gap and/or the arrow head.
Style your connector using the options in the Style tab in the format panel on the right in draw.io

Pattern - Use the top-middle drown-down list to select a different pattern for the connector’s line/outline. Choose from solid, dashed, or dotted in various patterns.
Style your connector using the options in the Style tab in the format panel on the right in draw.io

Thickness - Enter a new pt value in the textbox to change the thickness of the connector’s line/outline.
Style your connector using the options in the Style tab in the format panel on the right in draw.io

Waypoints - Select one of the predefined paths which will determine how many waypoints are added to the connector.
Style your connector using the options in the Style tab in the format panel on the right in draw.io
In the example above, you can see that the different styles have very different waypoints. The entity relation waypoint style always leaves the source shape and enters the target shape on the same side and has two orthogonal bends in the connector - there are no other waypoints in this style of connector.

Source and target ‘arrow’ heads - Select a connector head from the very large drop down list. There are many different types of arrows and symbols. Choose None for just a plain line.
Style your connector using the options in the Style tab in the format panel on the right in draw.io

Line end and Line start - Set the size of the arrow head or symbol, and the space between it and the shape outline. Negative values for spacing will position the end of the connector inside the shape boundary.
Style your connector using the options in the Style tab in the format panel on the right in draw.io

Line jumps - Choose how overlapping connectors should be displayed. Change the size of the gap by entering a new number in the text box to the right of the line jump style.
Style your connector using the options in the Style tab in the format panel on the right in draw.io

Opacity - Change the opacity percentage to let shapes and connectors that are underneath your selected connector show through.
Style your connector using the options in the Style tab in the format panel on the right in draw.io

Shadow and Sketch - Enable the checkboxes to add a shadow to your connector, or make your connector look roughly hand-drawn.
Style your connector using the options in the Style tab in the format panel on the right in draw.io

You can copy and paste connector styles just like you would shape styles using the two buttons in the Style tab of the format panel - Copy Style and Paste Style.

Expand the property list at the bottom of the Style tab in the format panel, to change additional connector style properties.
Manually style your connector using key=value pairs in the Edit Style dialog

Manually edit a connector’s style

You can manually edit a connector’s style using key=value pairs.

  1. Right click on a connector, then select Edit Style. Alternatively select a connector then press Ctrl+E on Windows, or Cmd+E on macOS.
  2. Edit the style in the textbox then click Apply to save your changes.
    Manually style your connector using key=value pairs in the Edit Style dialog

See all of the available styling options and learn how to set a default style for the diagram editor

Follow us on GitHub, Twitter, Facebook.

Share: