Back to Tldraw

Shape with onClick

apps/examples/src/examples/shapes/tools/shape-with-onClick/README.md

4.5.11345 B
Original Source

A custom shape that uses ShapeUtil.onClick.


You can handle clicks on shapes by implementing the onClick method on your shape util. Unlike using React's onClick on DOM elements inside the shape component, ShapeUtil.onClick integrates with the editor's event system, so clicking and dragging both work correctly on unselected shapes.