āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/udecode/plate/(plugins)/(elements)/callout ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
title: Callout docs:
The fastest way to add the callout plugin is with the CalloutKit, which includes pre-configured CalloutPlugin with the Plate UI component.
CalloutElement: Renders callout elements.Add the kit to your plugins:
import { createPlateEditor } from 'platejs/react';
import { CalloutKit } from '@/components/editor/plugins/callout-kit';
const editor = createPlateEditor({
plugins: [
// ...otherPlugins,
...CalloutKit,
],
});
</Steps>
npm install @platejs/callout
Include CalloutPlugin in your Plate plugins array when creating the editor.
import { CalloutPlugin } from '@platejs/callout/react';
import { createPlateEditor } from 'platejs/react';
const editor = createPlateEditor({
plugins: [
// ...otherPlugins,
CalloutPlugin,
],
});
You can configure the CalloutPlugin with a custom component to render callout elements.
import { CalloutPlugin } from '@platejs/callout/react';
import { createPlateEditor } from 'platejs/react';
import { CalloutElement } from '@/components/ui/callout-node';
const editor = createPlateEditor({
plugins: [
// ...otherPlugins,
CalloutPlugin.withComponent(CalloutElement),
],
});
withComponent: Assigns CalloutElement to render callout elements.CalloutPluginCallout element plugin.
tf.insert.calloutInsert a callout element into the editor.
<API name="callout"> <APIOptions type="object"> <APIItem name="variant" type="string" optional> The variant of the callout to insert. </APIItem> <APIItem name="...InsertNodesOptions" type="InsertNodesOptions<V>"> Other options from `InsertNodesOptions`. </APIItem> </APIOptions> </API>useCalloutEmojiPickerManage the emoji picker functionality for callouts.
<API name="useCalloutEmojiPicker"> <APIOptions type="UseCalloutEmojiPickerOptions"> <APIItem name="isOpen" type="boolean"> Whether the emoji picker is open. </APIItem> <APIItem name="setIsOpen" type="(isOpen: boolean) => void"> Function to set the open state of the emoji picker. </APIItem> </APIOptions> <APIReturns type="object"> <APIItem name="emojiToolbarDropdownProps" type="object"> Props for the emoji toolbar dropdown. <APISubList> <APISubListItem parent="emojiToolbarDropdownProps" name="isOpen" type="boolean"> Whether the emoji picker is open. </APISubListItem> <APISubListItem parent="emojiToolbarDropdownProps" name="setIsOpen" type="(v: boolean) => void"> Function to set the open state of the emoji picker, respecting read-only mode. </APISubListItem> </APISubList> </APIItem> <APIItem name="props" type="object"> Props for the emoji picker component. <APISubList> <APISubListItem parent="props" name="isOpen" type="boolean"> Whether the emoji picker is open. </APISubListItem> <APISubListItem parent="props" name="setIsOpen" type="(isOpen: boolean) => void"> Function to set the open state of the emoji picker. </APISubListItem> <APISubListItem parent="props" name="onSelectEmoji" type="(options: { emojiValue?: any; icon?: any }) => void"> Function called when an emoji is selected. It updates the callout's icon and closes the picker. </APISubListItem> </APISubList> </APIItem> </APIReturns> </API>TCalloutElementinterface TCalloutElement extends TElement {
variant?: string;
icon?: string;
}
<API name="TCalloutElement">
<APIAttributes>
<APIItem name="variant" type="string" optional>
The variant of the callout.
</APIItem>
<APIItem name="icon" type="string" optional>
The icon or emoji to display.
</APIItem>
</APIAttributes>
</API>ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā