# PasswordInput ### Intro The PasswordInput component is usually used with [NumberKeyboard](#/en-US/number-keyboard) Component. ### Install ```js import { createApp } from 'vue'; import { PasswordInput, NumberKeyboard } from 'vant'; const app = createApp(); app.use(PasswordInput); app.use(NumberKeyboard); ``` ## Usage ### Basic Usage ```html ``` ```js export default { data() { return { value: '123', showKeyboard: true, }; }, }; ``` ### Custom Length ```html ``` ### Add Gutter ```html ``` ### Without Mask ```html ``` ### Hint Error Use `info` to set info message, use `error-info` prop to set error message. ```html ``` ```js export default { data() { return { value: '123', errorInfo: '', showKeyboard: true, }; }, watch: { value(value) { if (value.length === 6 && value !== '123456') { this.errorInfo = 'Password Mistake'; } else { this.errorInfo = ''; } }, }, }; ``` ## API ### Props | Attribute | Description | Type | Default | | ---------- | ------------------------------ | ------------------ | ------- | | value | Password value | _string_ | `''` | | info | Bottom info | _string_ | - | | error-info | Bottom error info | _string_ | - | | length | Maxlength of password | _number \| string_ | `6` | | gutter | Gutter of input | _number \| string_ | `0` | | mask | Whether to mask value | _boolean_ | `true` | | focused | Whether to show focused cursor | _boolean_ | `false` | ### Events | Event | Description | Arguments | | ----- | -------------------------------- | --------- | | focus | Triggered when input get focused | - |