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.
LineShapeUtil
LineShapeUtil provides functionality for multi-point line shapes with configurable styles and spline interpolation. Lines can be straight segments or smooth curves.
Overview
The line shape allows users to create connected line segments with multiple control points. Each point can be moved independently, and new points can be added by clicking the midpoint handles.Static properties
Shape type identifier
Line shape property definitions
Shape migration definitions
Shape properties
Line dash style
Line thickness
Line color
Interpolation method - ‘line’ for straight segments, ‘cubic’ for smooth curves
Dictionary of line points with fractional indexing
Shape scale factor
Point structure
Each point in thepoints object has:
Methods
getDefaultProps()
Returns default properties for new line shapes with two points.getGeometry(shape)
Returns the path geometry for the line, either straight segments or cubic spline.getHandles(shape)
Returns handles for all vertices and midpoint create handles.- Vertex handles - At each point, can be dragged to move the point
- Create handles - At segment midpoints, click to add new points
component(shape)
Renders the line using SVG path with configurable stroke styles.indicator(shape)
Renders a simplified path indicator for selection.Handle interactions
onHandleDrag(shape, info)
Handles dragging of vertex points and creation of new points.- Dragging vertex handles moves existing points
- Clicking create handles inserts new points at that location
onResize(shape, info)
Handles resizing by scaling all points proportionally.Configuration
Spline types
Line (‘line’):- Straight segments between points
- Sharp corners at vertices
- Simple and precise
- Smooth curves through all points
- Rounded corners
- More organic appearance
Usage examples
Creating a line programmatically
Smooth curve line
Adding points to existing line
Related
- ArrowShapeUtil - Line with arrowheads and labels
- DrawShapeUtil - Freehand drawing
- ShapeUtil - Base class