Slash Command
Slash command menu for quick insertion of various content types.
Loading...
Installation
npm install @udecode/plate-slash-command
Usage
import { SlashPlugin, SlashInputPlugin } from '@udecode/plate-slash-command/react';
const plugins = [
// ...otherPlugins,
SlashPlugin,
];
const components = {
// ...otherComponents,
[SlashInputPlugin.key]: SlashInputElement,
};
How to use:
- Type
/
anywhere in your document to open the slash menu. - Start typing to filter options or use arrow keys to navigate.
- Press Enter or click to select an option.
- Press Escape to close the menu without selecting.
Available options include:
- Headings
- Lists
💡 Use keywords to quickly find options. For example, type '/ul' for Bulleted List.
Examples
Plate UI
Refer to the preview above.
Plate Plus
Plugins
SlashPlugin
Extends TriggerComboboxPlugin
Options
Collapse all
- Default:
- Default:
'/'
- Default:
/^\s?$/
Function to create the combobox input element.
() => ({
children: [{ text: '' }],
type: SlashInputPlugin.key,
});
The character that triggers the slash command combobox.
Regular expression to match the character before the trigger.
SlashInputPlugin
Plugin for slash input functionality.