topBar
Description
Optional. Controls the configuration of the top toolbar in the editorUsage
topBar?: boolean | { items: IToolbarItem[] };
Parameters
The topbar
can take the next values:
true
– enables the top toolbarfalse
– hides the top toolbar- an object with the
items
array, where each element is a ToolbarItem and supports the same parameters asitems
in the Toolbar component
Examples
Adding top bar to editor
<script>
import { Editor } from "@svar-ui/svelte-editor";
const topBar = {
items: [
{ comp: "spacer" },
{ comp: "button", label: "Click me", onclick: () => alert("clicked") },
],
};
</script>
<Editor {topBar} />
Adding top bar and using form values in it
<script>
import { Editor } from "@svar-ui/svelte-editor";
import { Switch } from "@svar-ui/svelte-core";
const topBar = {
items: [
{ comp: "label", spacer: true, key: "label" },
{ comp: Switch, key: "state" },
],
};
const values = {
label: "Product N1",
state: false
};
</script>
<Editor {topBar} {values} />