getEditorItems
Factory that returns a fresh array of the default Editor field definitions: a text input plus a single multi-field schedule item. Pass recurring to get the recurrence-aware schedule item. Use it as a starting point when building a custom items list so the built-in fields are preserved without retyping their config.
Usage
getEditorItems(recurring = false): EditorItem[];
A new array is returned on each call.
recurring- whenfalse(default), the schedule item isevent-dates; whentrue, it isevent-recurrence, which also edits therrule.
Default fields
key | comp | Owned event fields | When |
|---|---|---|---|
text | text | text | always |
schedule | event-dates | start, end, allDay | recurring is false |
schedule | event-recurrence | start, end, allDay, rrule | recurring is true |
The schedule item is a single multi-field item. It saves its values directly onto the event (not under a nested schedule property) and validates that end is not earlier than start. event-recurrence is a Pro-only component.
Example
Spread the defaults and append custom fields:
import { Calendar, Editor, getEditorItems, registerEditorItem } from "@svar-ui/react-calendar";
import { Comments } from "@svar-ui/react-comments";
registerEditorItem("comments", Comments);
const items = [
...getEditorItems(),
{
comp: "comments",
key: "comments",
label: "Comments",
users,
activeUser: 1,
},
];
function App() {
const [api, setApi] = useState();
return (
<>
<Calendar ref={setApi} events={events} />
{api && <Editor api={api} items={items} />}
</>
);
}
Related articles
registerEditorItem— bind a React component to a customcompid.Editor— companion that consumes thisitemsarray.- Editing — patterns for extending and replacing editor fields.