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.
HighlightShapeUtil
HighlightShapeUtil provides functionality for highlighter-style drawing with semi-transparent strokes. It’s similar to the draw tool but uses a different rendering style optimized for highlighting text or content.
Overview
The highlight shape creates freehand paths with a semi-transparent, marker-like appearance. It’s designed for emphasizing content without obscuring it.Static properties
Shape type identifier
Highlight shape property definitions
Shape migration definitions
Shape properties
Array of drawing segments, each containing points with pressure data
Highlight color
Highlight thickness
Whether the drawing is complete
Whether drawn with a pen/stylus (affects rendering)
Shape scale factor
Methods
getDefaultProps()
Returns default properties for new highlight shapes.getGeometry(shape)
Computes geometry from the highlight segments.Group2d containing the path geometry for all segments.
component(shape)
Renders the highlight using SVG paths with semi-transparent stroke.- Semi-transparent stroke for marker effect
- Optimized path simplification
- Smooth curves between points
- Pressure-sensitive width (when using pen)
indicator(shape)
Renders a simplified indicator for selection.Usage
Creating highlights programmatically
Highlighting with different colors
Adjusting highlight thickness
Differences from DrawShapeUtil
While similar toDrawShapeUtil, highlights have key differences:
| Feature | HighlightShapeUtil | DrawShapeUtil |
|---|---|---|
| Opacity | Semi-transparent | Opaque |
| Purpose | Emphasizing content | General drawing |
| Style | Marker-like | Pen-like |
| Fill | Never filled | Can be filled |
Common patterns
Temporary highlight overlay
Multiple highlight colors
Related
- DrawShapeUtil - Freehand drawing with opaque strokes
- LineShapeUtil - Multi-point line shapes
- ShapeUtil - Base class for all shapes