Vue UI Components Documentation
The Vue NavBar is a responsive horizontal or vertical navigation bar. This guide adds the Vue NavBar (jqxNavBar) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-scriptsjqwidgets-scripts/jqwidgets-vue3/vue_jqxnavbar.vue 
In a Vue 3 project (to start one, see Getting started with Vue), add the package:
npm install jqwidgets-scripts
import JqxNavBar from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxnavbar.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>
<div style="width: 80%">
NavBar with 2 Items. Each item is with 50% width.
<br />
<JqxNavBar :height="40" :selectedItem="0">
<ul>
<li>1</li>
<li>2</li>
</ul>
</JqxNavBar>
<br />
NavBar with 3 Items. Each item is with 33.33% width.
<br />
<JqxNavBar :height="40" :selectedItem="0">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</JqxNavBar>
<br />
NavBar with 4 Items. Each item is with 25% width.
<br />
<JqxNavBar :height="40" :selectedItem="0">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
</JqxNavBar>
<br />
NavBar with 5 Items. Each item is with 20% width.
<br />
<JqxNavBar :height="40" :selectedItem="0">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
</JqxNavBar>
<br />
NavBar with more than 5 Items. Items are displayed in 2 columns and each item is with 50%
width.
<br />
<JqxNavBar :height="160" :selectedItem="0">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
</ul>
</JqxNavBar>
<br />
NavBar with "columns" set to ["30%", "50%", "20%"].
<br />
<JqxNavBar :height="40" :selectedItem="0" :columns="['30%', '50%', '20%']">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</JqxNavBar>
</div>
</template>
<script setup>
import JqxNavBar from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxnavbar.vue';
</script>
<style></style>Options are attributes. Bind values from the script with :, for example :width="850".
Listen to an event with @ and its name. For example, change: This event is triggered when the user selects an item.
<script setup>
function onChange(event) {
console.log(event.args);
}
</script>
<template>
<JqxNavBar @change="onChange" />
</template>
Call methods through a template ref. For example, open: When NavBar is minimized, opens the popup.
<script setup>
import { ref, onMounted } from 'vue';
const myNavBar = ref(null);
onMounted(() => {
myNavBar.value.open();
});
</script>
<template>
<JqxNavBar ref="myNavBar" />
</template>
Every component also has setOptions({ … }) and getOptions('name').