Skip to content

Vizel API / svelte/src / createVizelSlashMenuRenderer

Function: createVizelSlashMenuRenderer()

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

Defined in: packages/svelte/src/runes/createVizelSlashMenuRenderer.svelte.ts:43

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

The menu component is mounted once per suggestion session. Subsequent onUpdate calls mutate the reactive props in place so the menu rerenders without losing internal state like the selected index. 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.

Parameters

ParameterType
optionsVizelSuggestionRendererOptions

Returns

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

Example

ts
import { createVizelSlashMenuRenderer } from '@vizel/svelte';
import { VizelSlashCommand } from '@vizel/core';

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

Released under the MIT License.