2021-01-20 23:56:25 +08:00
# Suggestion
2021-02-05 00:33:59 +08:00
[![Version ](https://img.shields.io/npm/v/@tiptap/suggestion.svg?label=version )](https://www.npmjs.com/package/@tiptap/suggestion)
[![Downloads ](https://img.shields.io/npm/dm/@tiptap/suggestion.svg )](https://npmcharts.com/compare/@tiptap/suggestion?minimal=true)
This utility helps with all kinds of suggestions in the editor. Have a look at the [`Mention` ](/api/nodes/mention ), [`Hashtag` ](/api/nodes/hashtag ) or [`Emoji` ](/api/nodes/emoji ) node to see it in action.
2021-01-20 23:56:25 +08:00
## Settings
2021-08-13 19:14:54 +08:00
| Option | Type | Default | Description |
| --------------- | ----------- | --------------------- | ----------------------------------------------------------- |
| char | `String` | `'@'` | The character that triggers the autocomplete popup. |
| pluginKey | `PluginKey` | `SuggestionPluginKey` | A ProseMirror PluginKey. |
| allowSpaces | `Boolean` | `false` | Allows or disallows spaces in suggested items. |
| startOfLine | `Boolean` | `false` | Trigger the autocomplete popup at the start of a line only. |
| decorationTag | `String` | `'span'` | The HTML tag that should be rendered for the suggestion. |
| decorationClass | `String` | `'suggestion'` | A CSS class that should be added to the suggestion. |
| command | `Function` | `() => {}'` | Executed when a suggestion is selected. |
| items | `Function` | `() => {}` | Pass an array of filtered suggestions, can be async. |
| render | `Function` | `() => ({})` | A render function for the autocomplete popup. |
2021-01-20 23:56:25 +08:00
## Source code
2021-04-21 21:31:11 +08:00
[packages/suggestion/ ](https://github.com/ueberdosis/tiptap/blob/main/packages/suggestion/ )
2021-01-20 23:56:25 +08:00