@mocanvas/editor · interface
interface TLUiToolItemOne entry in the UI tool list: everything the chrome needs to draw a tool
and to bind its shortcut. Registering an item is what gives a tool a
keyboard shortcut — a state-chart tool that is registered on the editor but
has no item here is reachable only through editor.setCurrentTool.
Methods · 1
onSelect(source?: TLUiEventSource): voidActivate the tool.
Properties · 7
disabled?: booleanRender the item, but inert.
icon: stringIcon name. An unknown name falls back to the label's initial.
id: stringThe item's id. For a tool that maps one-to-one onto a state-chart node
this is the tool id; for one of several items driving the same node (the
geo shapes all drive geo) it is the item's own id, and meta carries
what distinguishes it.
kbd?: stringKeyboard shortcut. Comma-separated alternatives, so a tool can answer to
more than one key ("d,b,x"); merge into this rather than replacing it
when adding a binding, or you silently drop the others.
label: stringDisplay text. Already localized: mocanvas does not translate it.
meta?: Record<string, unknown>Anything the item needs beyond the above. mocanvas reads one key:
geo, the geo kind an item selects, so the toolbar can show which of the
geo items is the active one.
readonlyOk?: booleanKeep the shortcut live on a read-only editor. Defaults to false.
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.