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
comp | key | label | Extra config |
|---|---|---|---|
text | text | Text | - |
date-time-picker | start | Start date | time: true, config: { buttons: false } |
date-time-picker | end | End date | time: true, config: { buttons: false } |
checkbox | allDay | All 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} />}
</>
);
}
Related articles
registerEditorItem— bind a React component to a customcompid.Editor— companion that consumes thisitemsarray.- Editing — patterns for extending and replacing editor fields.