items
items: Array<Item>
this property controls the contents of the toolbar. It defines an array of items that will be displayed. The default value is an empty array.
Item Structure
id
: string - unique identifier for the itemcomp
: string - specifies the component type (e.g., "button", "icon", "separator", "spacer")icon
: string - defines the icon to displaycss
: string - custom CSS class for stylinghandler
: function - event handler for item interactionlabel
: string - text label for the itemtext
: string - alternative text for displaylayout
: string - layout type for grouping items (e.g., "row")items
:Array<Item>
- nested array of items for groups
Usage
Defining button inside of toolbar
<script>
let items = [
{
id: "search",
comp: "button",
icon: "wxi-search",
css: "right",
handler: onClick,
},
];
</script>
<Toolbar {items} />
all parameters are optional
Defining a group of items (column)
<Toolbar
items={[
{ label: "My App" },
{
layout: "row",
items: [
{ comp: "icon", id: "add", icon: "wxi-plus" },
{ comp: "icon", id: "edit", icon: "wxi-pencil" },
{ comp: "icon", id: "delete", icon: "wxi-trash" },
],
},
]}
/>
Defining icon inside of toolbar
<Toolbar items={[{ comp: "icon", icon: "wxi-search" }]} />
Defining label inside of toolbar
<Toolbar items={[{ text: "My App" }]} />
Defining a group of items (row)
<Toolbar
items={[
{ label: "My App" },
{
layout: "row",
items: [
{ comp: "icon", id: "add", icon: "wxi-plus" },
{ comp: "icon", id: "edit", icon: "wxi-pencil" },
{ comp: "icon", id: "delete", icon: "wxi-trash" },
],
},
]}
/>
Defining separator inside of toolbar
<Toolbar
items={[
{ comp: "icon", icon: "wxi-search" },
{ comp: "separator" },
{ comp: "icon", icon: "wxi-plus" },
]}
/>
Pushing items to the right side of toolbar
<Toolbar
items={[
{ id: "label", text: "My App" },
{ comp: "spacer" },
{
comp: "icon",
icon: "wxi-search",
css: "right",
},
]}
/>