Vue UI Components Documentation
The Vue Layout allows the creation of complex layouts with panels that can be nested, resized, pinned, unpinned and closed. This guide adds the Vue Layout (jqxLayout) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-scriptsjqwidgets-scripts/jqwidgets-vue3/vue_jqxlayout.vue 
In a Vue 3 project (to start one, see Getting started with Vue), add the package:
npm install jqwidgets-scripts
import JqxLayout from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxlayout.vue';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.base.css';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.tailwind-blue-dark.css';
With <script setup>, an imported component is ready to use in the template. jqx.base.css is required; the second file is a theme, selected with the theme attribute.
The Default Functionality demo as a Single-File Component:
<template>
<JqxLayout :width="width" :height="600" :layout="layout">
<!--The panel content divs can have a flat structure-->
<!--autoHideGroup-->
<div data-container="ToolboxPanel">List of tools</div>
<div data-container="HelpPanel">Help topics</div>
<!--documentGroup-->
<div data-container="Document1Panel">Document 1 content</div>
<div data-container="Document2Panel">Document 2 content</div>
<!--bottom tabbedGroup-->
<div data-container="ErrorListPanel">List of errors</div>
<div data-container="OutputPanel">Output</div>
<!--right tabbedGroup-->
<div data-container="SolutionExplorerPanel">
<div id="treeContainer" style="border: none"></div>
</div>
<div data-container="PropertiesPanel">List of properties</div>
</JqxLayout>
</template>
<script setup>
import { ref } from 'vue';
import JqxLayout from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxlayout.vue';
import JqxTree from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxtree.vue';
let source = [
{
icon: 'https://www.jqwidgets.com/vue/images/earth.png',
label: 'Project',
expanded: true,
items: [
{
icon: 'https://www.jqwidgets.com/vue/images/folder.png',
label: 'css',
expanded: true,
items: [
{
icon: 'https://www.jqwidgets.com/vue/images/nav1.png',
label: 'jqx.base.css'
},
{
icon: 'https://www.jqwidgets.com/vue/images/nav1.png',
label: 'jqx.energyblue.css'
},
{
icon: 'https://www.jqwidgets.com/vue/images/nav1.png',
label: 'jqx.orange.css'
}
]
},
{
icon: 'https://www.jqwidgets.com/vue/images/folder.png',
label: 'scripts',
items: [
{ icon: 'https://www.jqwidgets.com/vue/images/nav1.png', label: 'jqxcore.js' },
{ icon: 'https://www.jqwidgets.com/vue/images/nav1.png', label: 'jqxdata.js' },
{ icon: 'https://www.jqwidgets.com/vue/images/nav1.png', label: 'jqxgrid.js' }
]
},
{ icon: 'https://www.jqwidgets.com/vue/images/nav1.png', label: 'index.htm' }
]
}
];
// the panels' widths add up to 800px (on a narrower page: 90% of the page)
const width = ref(document.body.offsetWidth < 800 ? '90%' : 800);
const layout = ref([
{
type: 'layoutGroup',
orientation: 'horizontal',
items: [
{
type: 'autoHideGroup',
alignment: 'left',
width: 80,
unpinnedWidth: 200,
items: [
{ type: 'layoutPanel', title: 'Toolbox', contentContainer: 'ToolboxPanel' },
{ type: 'layoutPanel', title: 'Help', contentContainer: 'HelpPanel' }
]
},
{
type: 'layoutGroup',
orientation: 'vertical',
width: 500,
items: [
{
type: 'documentGroup',
height: 400,
minHeight: 200,
items: [
{
type: 'documentPanel',
title: 'Document 1',
contentContainer: 'Document1Panel'
},
{
type: 'documentPanel',
title: 'Document 2',
contentContainer: 'Document2Panel'
}
]
},
{
type: 'tabbedGroup',
height: 200,
pinnedHeight: 30,
items: [
{
type: 'layoutPanel',
title: 'Error List',
contentContainer: 'ErrorListPanel'
},
{
type: 'layoutPanel',
title: 'Output',
contentContainer: 'OutputPanel',
selected: true
}
]
}
]
},
{
type: 'tabbedGroup',
width: 220,
minWidth: 200,
items: [
{
type: 'layoutPanel',
title: 'Solution Explorer',
contentContainer: 'SolutionExplorerPanel',
initContent: () => {
jqwidgets.createInstance('#treeContainer', 'jqxTree', {
source: source,
height: '99%',
width: '100%'
});
}
},
{
type: 'layoutPanel',
title: 'Properties',
contentContainer: 'PropertiesPanel'
}
]
}
]
}
]);
</script>
<style>
.jqx-layout-group-auto-hide-content-vertical {
width: 200px;
}
</style>Options are attributes. Bind values from the script with :, for example :width="850".
Listen to an event with @ and its name. For example, pin: This event is triggered when a group has been pinned.
<script setup>
function onPin(event) {
console.log(event.args);
}
</script>
<template>
<JqxLayout @pin="onPin" />
</template>
Call methods through a template ref. For example, refresh: Refreshes the widget.
<script setup>
import { ref, onMounted } from 'vue';
const myLayout = ref(null);
onMounted(() => {
myLayout.value.refresh();
});
</script>
<template>
<JqxLayout ref="myLayout" />
</template>
Every component also has setOptions({ … }) and getOptions('name').