Skip to content

Vizel API / core/src / VizelMentionOptions

Interface: VizelMentionOptions

Defined in: packages/core/src/extensions/mention.ts:42

Options for the mention extension.

Properties

deleteTriggerWithBackspace?

ts
optional deleteTriggerWithBackspace?: boolean;

Defined in: packages/core/src/extensions/mention.ts:73

Whether to delete the trigger character when removing a mention with backspace.

Default

ts
false

encoding?

ts
optional encoding?: VizelMarkdownLossyEncodingMode;

Defined in: packages/core/src/extensions/mention.ts:86

Markdown encoding mode.

  • "default" emits the lossy form @username. The mention id is lost on round-trip if the label and id differ.
  • "metadata-comment" emits the lossless form @username <!-- vizel:mention id="..." --> so the id survives round-trips through plain markdown.

Default

ts
"default"

HTMLAttributes?

ts
optional HTMLAttributes?: Record<string, string>;

Defined in: packages/core/src/extensions/mention.ts:91

Custom HTML attributes for the rendered mention element.


items?

ts
optional items?: (query, editor) => 
  | VizelMentionItem[]
| Promise<VizelMentionItem[]>;

Defined in: packages/core/src/extensions/mention.ts:55

Function to fetch mention suggestions based on query text. Called every time the user types after the trigger character.

Parameters

ParameterType
querystring
editorEditor

Returns

| VizelMentionItem[] | Promise&lt;VizelMentionItem[]&gt;

Example

ts
items: async (query) => {
  const res = await fetch(`/api/users?q=${query}`);
  return res.json();
}

suggestion?

ts
optional suggestion?: Partial<SuggestionOptions<VizelMentionItem, any>>;

Defined in: packages/core/src/extensions/mention.ts:67

Framework-specific suggestion renderer configuration. Set by framework packages (react, vue, svelte) via createVizelMentionMenuRenderer().


trigger?

ts
optional trigger?: string;

Defined in: packages/core/src/extensions/mention.ts:61

Trigger character that activates mention suggestions.

Default

ts
"@"

Released under the MIT License.