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
| Parameter | Type |
|---|---|
options | VizelSuggestionRendererOptions |
Returns
Partial<SuggestionOptions<VizelCommand>>
Example
tsx
import { VizelSlashCommand } from '@vizel/core';
import { createVizelSlashMenuRenderer } from '@vizel/react';
const editor = useEditor({
extensions: [
VizelSlashCommand.configure({
suggestion: createVizelSlashMenuRenderer(),
}),
],
});