Skip to main content

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 - when false (default), the schedule item is event-dates; when true, it is event-recurrence, which also edits the rrule.

Default fields

keycompOwned event fieldsWhen
texttexttextalways
scheduleevent-datesstart, end, allDayrecurring is false
scheduleevent-recurrencestart, end, allDay, rrulerecurring 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} />}
</>
);
}
  • registerEditorItem — bind a React component to a custom comp id.
  • Editor — companion that consumes this items array.
  • Editing — patterns for extending and replacing editor fields.