Get the latest version by NPM:
$ npm i @craydel/craydel-password-field
If you use the plugin API, the component will be registered as a global component just like when
including it with the script tag, but you won't need to re-register it through the components
property in your own
components.
Create the plugin file e.g craydel-components.js
file.
// craydel-components.js
import Vue from 'vue'
import CraydelPasswordField from '@craydel/craydel-password-field/src/CraydelPasswordField.vue'
const Components = {
CraydelPasswordField,
};
Object.keys(Components).forEach(name => {
Vue.component(name, Components[name]);
});
export default Components;
Next reference the plugin file in your nuxt.config.js
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
'~/plugins/craydel-components.js'
]
Name | Type | Default | Description |
---|---|---|---|
id | string | random ID | Sets the DOM id on the component. |
placeholder | string | 'Enter password' | Sets the component's placeholder text. |
placeholder-confirm | string | 'Enter password' | Sets the component's confirm password placeholder text. |
is-required | boolean | false | Puts component in a required state. |
required-error | string | 'Field is required' | Puts the component in an error state and passes through the custom required error message. |
confirm-required-error | string | 'Field is required' | Puts the component in an error state and passes through the custom required error message for the confirm password field. |
confirm-error-message | string | 'Passwords must match' | Puts the component in an error state and passes through the custom error message when password and confirm password fields do not match. |
max-length | number | 100 | The maximum number of characters allowed in the field. |
show-password-strength | boolean | false | Displays a password strength meter and a defined set of rules. |
show-confirm-field | boolean | false | Displays the confirm password field. |
hint | string | undefined | Hint text. |
no-validation | boolean | false | Removes the validation styling from the component. |
An example showing a password field that shows a password strength meter and a confirm password field.
<craydel-password-field show-confirm-field show-password-strength></craydel-password-field>