Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tldraw/tldraw/llms.txt
Use this file to discover all available pages before exploring further.
ArrowShapeUtil handles arrow shapes which can connect to and bind to other shapes, support different arrow styles (straight, arc, elbow), and include optional text labels.
Type signature
Features
- Three arrow kinds:
arc,straight, andelbow - Configurable start and end arrowheads
- Bindings to other shapes with precise/imprecise modes
- Rich text labels with positioning
- Customizable colors, sizes, and dash styles
- Fill support for certain arrowhead types
Configuration options
Default props
Properties
The type of arrow path to render.
The start point of the arrow in local shape space.
The end point of the arrow in local shape space.
The bend amount for arc arrows. Positive values bend clockwise.
The arrowhead style at the start:
'none', 'arrow', 'bar', 'dot', 'diamond', 'inverted', 'pipe', 'square', 'triangle'The arrowhead style at the end.
Rich text content for the arrow label.
Position of the label along the arrow (0 to 1).
Handles
Arrows have 2-3 handles depending on the arrow kind:Arc/Straight arrows
start- The start point (vertex handle)end- The end point (vertex handle)middle- Bend control (virtual handle, arc only)
Elbow arrows
start- The start point (vertex handle)end- The end point (vertex handle)middle- Midpoint adjustment (vertex handle, conditional)
Bindings
Arrows support bindings to other shapes via the@tldraw/arrow-binding system.
canBind()
Binding modes
- Imprecise - Arrow points generally at the shape
- Precise - Arrow points to a specific anchor point
- Exact - Arrow points to an exact position (hold Alt)
Methods
getGeometry()
Returns aGroup2d containing:
- The arrow body (Edge2d, Arc2d, or Polyline2d)
- Optional label geometry (Rectangle2d)
getHandles()
Returns start, end, and optionally middle handles based on arrow kind and geometry.onHandleDrag()
Handles dragging of arrow endpoints and midpoint:- Updates bindings when dragging endpoints
- Adjusts bend for arc arrows
- Adjusts elbow midpoint position
onTranslateStart()
Handles arrow translation with special logic for:- Maintaining bindings when translating with bound shapes
- Removing bindings for solo elbow arrow translation
onResize()
Handles arrow resizing:- Scales unbound endpoints
- Updates bound anchor positions
- Maintains bend proportionally