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:
<script lang="ts">
import { Calendar, Editor, getEditorItems, registerEditorItem } from "@wx/svelte-calendar";
import { Comments } from "@wx/svelte-comments";
registerEditorItem("comments", Comments);
const items = [
...getEditorItems(),
{
comp: "comments",
key: "comments",
label: "Comments",
users,
activeUser: 1,
},
];
let api = $state();
</script>
<Calendar bind:this={api} {events} />
{#if api}
<Editor {api} {items} />
{/if}
Related articles
registerEditorItem— bind a Svelte component to a customcompid.Editor— companion that consumes thisitemsarray.- Editing — patterns for extending and replacing editor fields.