Skip to main content

getEditorItems

Factory that returns a fresh array of the default Editor field definitions: a text input plus start, end, and all-day fields. 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(): EditorItem[];

A new array is returned on each call.

Default fields

compkeylabelExtra config
texttextText-
date-time-pickerstartStart datetime: true, config: { buttons: false }
date-time-pickerendEnd datetime: true, config: { buttons: false }
checkboxallDayAll day-

Example

Spread the defaults and append custom fields:

import { Calendar, Editor, getEditorItems, registerEditorItem } from "@wx/react-calendar";
import { Comments } from "@wx/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.