@mocanvas/editor · interface

TLUiOverrides

interface TLUiOverrides

Rewrite the UI's tool and action lists, passed as overrides.

Each callback receives the list built so far and returns the list to use. Mutating the argument and returning it is supported (it is a fresh object per build), but returning a new object is clearer.

There is one overrides slot, so an app composing two of these chains them itself: call the inner one first, then work on its result. That ordering matters — a chained override that adds a shortcut to a tool the inner one registers has to run second, or the tool is not there yet.


Properties · 3

actions?(editor: Editor, actions: TLUiActionsContextType, helpers: TLUiOverrideHelpers): TLUiActionsContextType

Rewrite the action list.

tools?(editor: Editor, tools: TLUiToolsContextType, helpers: TLUiOverrideHelpers): TLUiToolsContextType

Rewrite the tool list.

translations?: TLUiTranslations

Extra UI strings, keyed by locale and then by string id. What TLUiOverrideHelpers.msg resolves against.

``ts translations: { en: { "tool.comment": "Comment" }, cs: { "tool.comment": "Komentář" } } ``

mocanvas ships no strings of its own — an item's label is already display text — so this map is purely additive: it exists so an app whose own chrome asks msg(id) gets one dictionary rather than two.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.