Skip to content

Vizel API / core/src / createVizelSuggestionContainer

Function: createVizelSuggestionContainer()

ts
function createVizelSuggestionContainer(): VizelSuggestionContainer;

Defined in: packages/core/src/controllers/suggestionContainer.ts:58

Create a positioned container for suggestion popups.

This creates a container element that is:

  • Positioned absolutely in the document
  • Contains an inner element for mounting framework components
  • Provides a method to update position based on cursor location

Returns

VizelSuggestionContainer

A managed suggestion container

Example

typescript
// In a slash menu renderer:
const { container, menuContainer, updatePosition, destroy } =
  createVizelSuggestionContainer();

// Mount your framework component to menuContainer
ReactDOM.createRoot(menuContainer).render(<SlashMenu />);

// Update position when Tiptap provides new coordinates
updatePosition(props.clientRect);

// Clean up when done
destroy();

Released under the MIT License.