@mocanvas/mocanvas · function
declare function useActionState(actionId: string): {
disabled: boolean;
checked: boolean;
}Whether an action can run right now, and whether it is on.
The action list is built once per editor (see buildDefaultActionItems), so
an item cannot carry its own availability without freezing it. This is where
that question is answered instead: reactively, at the point of render, so a
menu row greys out the moment the selection stops supporting it.
An action with no rule here is always enabled and never checked, which is the right default for an app's own action: mocanvas knows nothing about when it applies, and guessing "disabled" would make a working item look broken.
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.