Skip to main content

README

Agent Runtimes


Agent Runtimes / lexical/useChatInlineToolbarItems

lexical/useChatInlineToolbarItems

useChatInlineToolbarItems - Hook that creates ToolbarItem[] for the FloatingTextFormatToolbarPlugin's extraItems prop.

Registers an AI sparkle button in the floating inline toolbar. Clicking the sparkle button directly opens the ChatInlinePlugin floating panel, where users can type free-form AI prompts.

Usage:

const { toolbarItems, isAiOpen, pendingPrompt, clearPendingPrompt, closeAi } =
useChatInlineToolbarItems();

<FloatingTextFormatToolbarPlugin
anchorElem={floatingAnchorElem}
setIsLinkEditMode={setIsLinkEditMode}
extraItems={toolbarItems}
/>

<ChatInlinePlugin
isOpen={isAiOpen}
onClose={closeAi}
pendingPrompt={pendingPrompt}
onPendingPromptConsumed={clearPendingPrompt}
/>

Interfaces

Functions

References

default

Renames and re-exports useChatInlineToolbarItems