The DOM requires that all IDs are unique. We often use e.g. shape IDs in the dom, but this isn't safe: if tldraw is rendered twice, or an SVG export is taking place, the IDs will clash and the browser will do weird things. This type is used to mark IDs that are unique and safe to use.

Use useUniqueSafeId to generate a unique safe ID. Use useSharedSafeId to generate the same ID across multiple components, but unique within a single tldraw/editor instance.

type SafeId = string & {
  __brand: 'SafeId'
}
Prev
RotateCorner
Next
SelectionCorner