Zum Hauptinhalt springen

activeBatch

Beschreibung

Optional. Steuert, welcher Batch von Eingaben im Editor aktuell aktiv ist

Verwendung

activeBatch?: string | number;

Beispiele

Einen Batch zur gleichen Zeit anzeigen

<script>
import { Editor } from "@svar-ui/svelte-editor";
import { Combo } from "@svar-ui/svelte-core";

registerEditorItem("combo", Combo);

const batchItems = [
{
comp: "text",
key: "name",
batch: "main",
label: "Name",
},
{
key: "theme",
batch: "cfg",
comp: "combo",
label: "Theme",
options: [
{ id: "light", label: "Light" },
{ id: "dark", label: "Dark" },
],
},
];

</script>

<Editor {items} activeBatch="cfg" />

Tabbar zur Steuerung der Sichtbarkeit verwenden

<script>
import { Combo, Tabs } from "@svar-ui/svelte-core";
import { Editor } from "@svar-ui/svelte-editor";

registerEditorItem("combo", Combo);

const options = [
{
id: "main",
label: "Personal",
},
{
id: "cfg",
label: "Settings",
},
];

const items = [
{
comp: "text",
key: "name",
batch: "main",
label: "Name",
},
{
key: "theme",
batch: "cfg",
comp: "combo",
label: "Theme",
options: [
{ id: "light", label: "Light" },
{ id: "dark", label: "Dark" },
],
},
];

const activeBatch = $state("cfg");
</script>

<Editor {items} {activeBatch}>
<Tabs {options} bind:value={activeBatch}></Tabs>
</Editor>