Vue UI Components Documentation
The Vue PasswordInput enables users to input passwords. This guide adds the Vue PasswordInput (jqxPasswordInput) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-scriptsjqwidgets-scripts/jqwidgets-vue3/vue_jqxpasswordinput.vue 
In a Vue 3 project (to start one, see Getting started with Vue), add the package:
npm install jqwidgets-scripts
import JqxPasswordInput from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxpasswordinput.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>
<JqxExpander ref="createAccount" :showArrow="false" :toggleMode="'none'" :width="350">
<div>Create a new account</div>
<div style="font-family: Verdana; font-size: 13px">
<JqxValidator
ref="myValidator"
@validationSuccess="validationSuccess($event)"
:rules="rules"
:hintType="'label'"
>
<form id="form" style="overflow: hidden; margin: 10px" action="./">
<table>
<tbody>
<tr>
<td colspan="2">First Name</td>
</tr>
<tr>
<td>
<JqxInput
ref="firstName"
class="firstName"
:width="300"
:height="21"
></JqxInput>
</td>
</tr>
<tr>
<td colspan="2">Last Name</td>
</tr>
<tr>
<td>
<JqxInput
ref="lastName"
class="lastName"
:width="300"
:height="21"
></JqxInput>
</td>
</tr>
<tr>
<td colspan="2">Choose your username</td>
</tr>
<tr>
<td colspan="2">
<JqxInput
ref="userName"
class="userName"
:width="300"
:height="21"
></JqxInput>
</td>
</tr>
<tr>
<td colspan="2">Create a password</td>
</tr>
<tr>
<td colspan="2">
<JqxPasswordInput
ref="password"
class="password"
:width="300"
:height="21"
></JqxPasswordInput>
</td>
</tr>
<tr>
<td colspan="2">Confirm your password</td>
</tr>
<tr>
<td colspan="2">
<JqxPasswordInput
ref="passwordConfirm"
class="passwordConfirm"
:width="300"
:height="21"
></JqxPasswordInput>
</td>
</tr>
<tr>
<td colspan="2">Birthday</td>
</tr>
<tr>
<td colspan="2">
<JqxDateTimeInput :width="300" :height="21"> </JqxDateTimeInput>
</td>
</tr>
<tr>
<td colspan="2">Gender</td>
</tr>
<tr>
<td colspan="2">
<JqxDropDownList
ref="gender"
class="gender"
:source="genders"
:selectedIndex="-1"
:placeHolder="'I am...'"
:dropDownHeight="50"
:width="300"
:height="21"
>
</JqxDropDownList>
</td>
</tr>
<tr>
<td colspan="2">
<JqxButton :width="150" @click="buttonClicked()"
>Create account</JqxButton
>
</td>
</tr>
</tbody>
</table>
</form>
</JqxValidator>
</div>
</JqxExpander>
</template>
<script setup>
import { ref } from 'vue';
import JqxPasswordInput from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxpasswordinput.vue';
import JqxExpander from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxexpander.vue';
import JqxValidator from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxvalidator.vue';
import JqxInput from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxinput.vue';
import JqxDateTimeInput from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxdatetimeinput.vue';
import JqxDropDownList from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxdropdownlist.vue';
import JqxButton from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxbuttons.vue';
const firstName = ref(null);
const lastName = ref(null);
const password = ref(null);
const passwordConfirm = ref(null);
const gender = ref(null);
const myValidator = ref(null);
const createAccount = ref(null);
const genders = ref(['male', 'female']);
const rules = ref([
{
input: '.firstName',
message: 'First name is required!',
action: 'keyup, blur',
rule: (input, commit) => {
return firstName.value.val() != '' && firstName.value.val() != 'First';
}
},
{
input: '.lastName',
message: 'Last name is required!',
action: 'keyup, blur',
rule: (input, commit) => {
return lastName.value.val() != '' && lastName.value.val() != 'Last';
}
},
{
input: '.userName',
message: 'Username is required!',
action: 'keyup, blur',
rule: 'required'
},
{
input: '.password',
message: 'Password is required!',
action: 'keyup, blur',
rule: 'required'
},
{
input: '.passwordConfirm',
message: 'Password is required!',
action: 'keyup, blur',
rule: 'required'
},
{
input: '.passwordConfirm',
message: 'Passwords should match!',
action: 'keyup, blur',
rule: (input, commit) => {
let firstPassword = password.value.val();
let secondPassword = passwordConfirm.value.val();
return firstPassword == secondPassword;
}
},
{
input: '.gender',
message: 'Gender is required!',
action: 'blur',
rule: (input, commit) => {
let index = gender.value.getSelectedIndex();
return index != -1;
}
}
]);
function buttonClicked() {
myValidator.value.validate(document.getElementById('form'));
}
function validationSuccess(event) {
createAccount.value.setContent('<span style="margin: 10px;">Account created.</span>');
}
</script>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 value in the input is changed.
<script setup>
function onChange(event) {
console.log(event.args);
}
</script>
<template>
<JqxPasswordInput @change="onChange" />
</template>
Call methods through a template ref. For example, val: Gets or sets the password.
<script setup>
import { ref, onMounted } from 'vue';
const myPasswordInput = ref(null);
onMounted(() => {
const value = myPasswordInput.value.val();
console.log(value);
});
</script>
<template>
<JqxPasswordInput ref="myPasswordInput" />
</template>
Every component also has setOptions({ … }) and getOptions('name').