āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/udecode/plate/(plugins)/(elements)/date ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
title: Date docs:
The fastest way to add date functionality is with the DateKit, which includes pre-configured DatePlugin with Plate UI components.
DateElement: Renders inline date elements.Add the kit to your plugins:
import { createPlateEditor } from 'platejs/react';
import { DateKit } from '@/components/editor/plugins/date-kit';
const editor = createPlateEditor({
plugins: [
// ...otherPlugins,
...DateKit,
],
});
</Steps>
npm install @platejs/date
Include DatePlugin in your Plate plugins array when creating the editor.
import { DatePlugin } from '@platejs/date/react';
import { createPlateEditor } from 'platejs/react';
const editor = createPlateEditor({
plugins: [
// ...otherPlugins,
DatePlugin,
],
});
Configure the plugin with a custom component to render date elements.
import { DatePlugin } from '@platejs/date/react';
import { createPlateEditor } from 'platejs/react';
import { DateElement } from '@/components/ui/date-node';
const editor = createPlateEditor({
plugins: [
// ...otherPlugins,
DatePlugin.withComponent(DateElement),
],
});
withComponent: Assigns DateElement to render inline date elements.You can add this item to the Insert Toolbar Button to insert date elements:
{
focusEditor: true,
icon: <CalendarIcon />,
label: 'Date',
value: KEYS.date,
}
</Steps>
DatePluginPlugin for adding date elements to your document.
isPointNextToNodeCheck if a point is next to a specific node type.
<API name="isPointNextToNode"> <APIParameters> <APIItem name="nodeType" type="string"> The type of node to check for adjacency (e.g. 'date' for inline date elements). </APIItem> <APIItem name="options" type="object"> Options for checking adjacency. </APIItem> </APIParameters> <APIOptions type="object"> <APIItem name="at" type="Point" optional> Position to check from. Uses current selection anchor if not provided. </APIItem> <APIItem name="reverse" type="boolean"> Direction to check. If true, checks previous node; if false, checks next node. </APIItem> </APIOptions> </API>tf.insert.dateā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā