Skip to content

Vizel API / react/src / createVizelSlashMenuRenderer

Function: createVizelSlashMenuRenderer()

ts
function createVizelSlashMenuRenderer(options?): Partial<SuggestionOptions<VizelCommand>>;

Defined in: packages/react/src/hooks/createVizelSlashMenuRenderer.ts:39

Creates a suggestion render configuration for the SlashCommand extension. This handles the popup positioning and React component lifecycle.

The menu renders VizelCommandSpec items derived from the unified VizelCommand registry. Selecting an item maps its id back to the matching command and forwards it to Tiptap's props.command, which runs the command after the extension deletes the slash trigger text.

Parameters

ParameterType
optionsVizelSuggestionRendererOptions

Returns

Partial&lt;SuggestionOptions&lt;VizelCommand&gt;&gt;

Example

tsx
import { VizelSlashCommand } from '@vizel/core';
import { createVizelSlashMenuRenderer } from '@vizel/react';

const editor = useEditor({
  extensions: [
    VizelSlashCommand.configure({
      suggestion: createVizelSlashMenuRenderer(),
    }),
  ],
});

Released under the MIT License.