TLUiActionItem

See source code
Table of contents
interface TLUiActionItem<
  TransationKey extends string = string,
  IconType extends string = string,
> {}

Properties

checkbox

optional
checkbox?: boolean;

icon

optional
icon?: IconType | React.ReactElement;

id

id: string;

isRequiredA11yAction

optional
isRequiredA11yAction?: boolean;

kbd

optional
kbd?: string;

label

optional
label?:
  | {
      [key: string]: TransationKey;
    }
  | TransationKey;

readonlyOk

optional
readonlyOk?: boolean;

Methods

isAvailable

optional

Whether the action exists in the current context at all, e.g. clipboard support or debug mode. Menus hide the item when it returns false (the keyboard shortcuts dialog still lists it); keyboard shortcuts ignore it. Must be pure and read only editor state.

Parameters

NameDescription

editor

Editor;

Returns

boolean;

isChecked

optional

For checkbox actions: whether the item shows as checked. Must be pure and read only editor state.

Parameters

NameDescription

editor

Editor;

Returns

boolean;

isEnabled

optional

Whether the action can run now. Menus disable or hide the item when it returns false; keyboard shortcuts ignore it. Must be pure and read only editor state: menus re-run it when that state changes, so anything else it reads goes stale.

Parameters

NameDescription

editor

Editor;

Returns

boolean;

onSelect

Parameters

NameDescription

source

Returns

Promise<void> | void;

Prev
TLUiA11yContextType
Next
TLUiActionsMenuProps