AI Leaf
plate/ai-nodeFreeComponent
A text highlighter for AI-generated content.
Live preview
live · rendered by the registry
Rendered by plate on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://platejs.org/r/ai-node.jsonSource
1'use client';23import { AIChatPlugin } from '@platejs/ai/react';4import {5 type PlateElementProps,6 type PlateTextProps,7 PlateElement,8 PlateText,9 usePluginOption,10} from 'platejs/react';1112import { cn } from '@/lib/utils';1314export function AILeaf(props: PlateTextProps) {15 const streaming = usePluginOption(AIChatPlugin, 'streaming');16 const streamingLeaf = props.editor17 .getApi(AIChatPlugin)18 .aiChat.node({ streaming: true });1920 const isLast = streamingLeaf?.[0] === props.text;2122 return (23 <PlateText24 className={cn(25 'border-b-2 border-b-purple-100 bg-purple-50 text-purple-800',26 'transition-all duration-200 ease-in-out',27 isLast &&28 streaming &&29 'after:ml-1.5 after:inline-block after:h-3 after:w-3 after:rounded-full after:bg-primary after:align-middle after:content-[""]'30 )}31 {...props}32 />33 );34}3536export function AIAnchorElement(props: PlateElementProps) {37 return (38 <PlateElement {...props}>39 <div className="h-[0.1px]" />40 </PlateElement>41 );42}
Files it writes
More from plate
All 324 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| ai-kitai-kit | plate | Components | Free | 1 dep | |
| AI Menuai-menu | plate | Components | Free | 5 deps · 2 files | |
| AI Toolbar Buttonai-toolbar-button | plate | Components | Free | 1 dep | |
| align-base-kitalign-base-kit | plate | Components | Free | 1 dep | |
| align-kitalign-kit | plate | Components | Free | 1 dep | |
| Align Toolbar Buttonalign-toolbar-button | plate | Components | Free | 1 dep | |
| autoformat-classic-kitautoformat-classic-kit | plate | Components | Free | 2 deps | |
| autoformat-kitautoformat-kit | plate | Components | Free | 2 deps |
