@craydel/craydel-alert
v1.1.4
Published
A custom Vuetify alert component for Craydel.
Readme
CraydelAlert
Installation
Get the latest version by NPM:
$ npm i @craydel/craydel-alertRegister Plugin
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 CraydelAlert from '@craydel/craydel-alert/src/CraydelAlert.vue'
const Components = {
CraydelAlert,
};
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'
]Props
| Name | Type | Default | Description | |-------------|---------|-----------|:-------------------------------------------------------------------------------------------------------| | show-alert | boolean | false | Controls whether the component is visible or hidden. | | type | string | undefined | Specify a success, info, warning or error alert. Uses the contextual color and has a pre-defined icon. | | dismissible | boolean | true | Adds a close icon that can hide the alert. |
Events
| Name | Description | |--------|:----------------------------------------------------| | closed | Event that is emitted when the component is closed. |
Usage
An example showing a red error alert without the close icon.
<craydel-alert show-alert type="error" :dismissible="false">
This is an error message
</craydel-alert>