Components
Ghost Text
Ghost Text
Display AI-generated suggestions in a hover card.
Installation
npx @udecode/plate-ui@latest add ghost-text
Examples
'use client';
import React from 'react';
import type { CopilotPluginConfig } from '@udecode/plate-ai/react';
import { useEditorPlugin, useElement } from '@udecode/plate-common/react';
export const GhostText = () => {
const { useOption } = useEditorPlugin<CopilotPluginConfig>({
key: 'copilot',
});
const element = useElement();
const isSuggested = useOption('isSuggested', element.id as string);
if (!isSuggested) return null;
return <GhostTextContent />;
};
export function GhostTextContent() {
const { useOption } = useEditorPlugin<CopilotPluginConfig>({
key: 'copilot',
});
const suggestionText = useOption('suggestionText');
return (
<span className="text-muted-foreground" contentEditable={false}>
{suggestionText && suggestionText}
</span>
);
}
Plate Plus
In Plate Plus, we provides more advanced styles and complete backend setup
- Hover card: a new style of hover card that is more user-friendly. You can hover over the ghost text to see the hover card.
- Marks: support for marks like bold, italic, underline, etc.This means you can see bold text and links in the ghost text
- Backend: complete backend setup.
All of the backend setup is available in Potion template.
Build your editor even faster
Complete, deployable AI-powered template with backend.
All components included.
Customizable and extensible.
Get all-accessCustomizable and extensible.