@gn5r/vue-confirm
Vue Confirm Component
Dependencies version
Playground
Version matrix
| Vue.js version | Package version | Type definition | Branch |
|---|---|---|---|
| 2.x | 1.x | No | 1.x |
| 2.x | 2.x | Yes | 2.x |
| 3.x | 3.x | Yes | 3.x |
| 3.x | 4.x | Yes | main |
Installation
npm tag martix
| Package version | tag | Volar support | EOL |
|---|---|---|---|
| 1.x | - | - | ○ |
| 2.x | legacy | - | ○ |
| 3.x | stable | Yes | × |
| 4.x | latest | Yes | × |
| *-beta | beta | - | - |
| *-next | next | - | - |
commands
npm
npm i @gn5r/vue-confirm
yarn
yarn add @gn5r/vue-confirm
Usage
Using Vue.use
// main.ts
import { createApp } from "vue";
import App from "./App.vue";
// Importing Plugin Function and css
import { createVConfirm } from "@gn5r/vue-confirm";
import "@gn5r/vue-confirm/styles";
const app = createApp(App);
const vconfirm = createVConfirm();
app.use(vconfirm).mount("#app");
<!-- SampleComponent.vue -->
<template>
<button type="button" @click="show">show</button>
<v-confirm
v-model="config.dialog"
:title="config.title"
:message="config.message"
:btns="config.btns"
/>
</template>
<script lang="ts">
import { defineComponent, ref } from "vue";
import { VConfirmBtn } from "@gn5r/vue-confirm";
export default defineComponent({
name: "sample-component",
setup() {
const config = ref({
dialog: false,
title: "title",
message: "message!",
btns: [] as VConfirmBtn[],
});
function show() {
config.value.btns = [
{
text: "OK",
onClick: () => (config.value.dialog = false),
},
];
config.value.dialog = true;
}
return {
config,
show,
};
},
});
</script>
Not using Vue.use
<!-- SampleComponent.vue -->
<template>
<button type="button" @click="show">show</button>
<v-confirm
v-model="config.dialog"
:title="config.title"
:message="config.message"
:btns="config.btns"
/>
</template>
<script lang="ts">
import { defineComponent, ref } from "vue";
import VConfirm, { VConfirmBtn } from "@gn5r/vue-confirm";
export default defineComponent({
name: "sample-component",
setup() {
const config = ref({
dialog: false,
title: "title",
message: "message!",
btns: [] as VConfirmBtn[],
});
function show() {
config.value.btns = [
{
text: "OK",
onClick: () => (config.value.dialog = false),
},
];
config.value.dialog = true;
}
return {
config,
show,
};
},
components: {
VConfirm,
},
});
</script>
Confirm component props
| props | description | type | default |
|---|---|---|---|
| btn-align | justify-content css property. Available options are start,cenetr,end,space-between,space-around. |
Alignment(string) | end |
| btns | Action buttons | VConfirmBtn[] | [] |
| closable | show / hide flag of close icon to dialog | boolean | false |
| dark | Enable dark theme | boolean | false |
| hide-header | hidden default header | boolean | false |
| message | Message text | string | undefined |
| modelValue | show / hide flag of dialog | boolean | false |
| no-actions-divider | show / hide flag of between message and actions divider | boolean | false |
| persistent | Clicking outside of the element not deactivate it | boolean | false |
| title | Title text | string | undefined |
| title-color | Toolbar color | string | inherit |
| title-text-color | Text color of title bar | string | inherit |
| width | Component width | number | string | 800px |
VConfirmBtn description
| name | description | type | default |
|---|---|---|---|
| class | css classes for button | string | string[] | undefined |
| color | background-color for button. It can be specify css style color ( #fff or transparent or inherit) or class style color (btn-primary) |
string | undefined |
| onClick | function executed when the button is clicked | Function | VoidFunction | undefined |
| text | text in button | string | undefined |
| textColor | color for button text. It can be specify css style color ( #fff or transparent or inherit) or class style color (btn-primary) |
string | undefined |
License
Copyright (c) 2026 shangyuan.tuolang
Related Packages
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 4.1.6 | >=3.3 | MIT | |
| 4.1.5 | >=3.3 | MIT | |
| 4.1.4 | >=3.3 | MIT | |
| 4.1.3 | >=3.3 | MIT | |
| 4.1.2 | >=3.3 | MIT | |
| 4.1.1 | >=3.3 | MIT | |
| 4.1.0 | >=3.3 | MIT | |
| 4.0.0 | ^3.3.4 | MIT | |
| 3.4.0 | >=3.3 | MIT | |
| 3.3.0 | ^3.3.4 | MIT | |
| 3.2.4 | ^3.2.45 | MIT | |
| 3.2.3 | ^3.2.45 | MIT | |
| 3.2.2 | ^3.2.45 | MIT | |
| 3.2.1 | ^3.2.45 | MIT | |
| 3.2.0 | ^3.2.45 | MIT | |
| 3.1.0 | ^3.2.45 | MIT | |
| 3.0.0 | ^3.2.45 | MIT | |
| 2.4.0 | ^2.6.14 | MIT | |
| 2.3.0 | ^2.6.14 | MIT | |
| 2.2.0 | ^2.6.14 | MIT | |
| 2.1.1 | ^2.6.14 | MIT | |
| 2.1.0 | ^2.6.14 | MIT | |
| 2.0.3 | ^2.6.14 | MIT | |
| 2.0.2 | ^2.6.14 | MIT | |
| 2.0.1 | ^2.6.14 | MIT | |
| 2.0.0 | ^2.6.14 | MIT | |
| 1.0.1 | ^2.6.11 | MIT |
Pre-releases (20)
| Version | Released | Vue | License |
|---|---|---|---|
| 4.1.0-beta.0 | ^>=3.3 | MIT | |
| 4.0.0-next.0 | ^3.3.4 | MIT | |
| 3.3.0-beta.3 | ^3.3.4 | MIT | |
| 3.3.0-beta.2 | ^3.3.4 | MIT | |
| 3.3.0-beta.1 | ^3.3.4 | MIT | |
| 3.3.0-beta.0 | ^3.3.4 | MIT | |
| 3.1.0-beta.1 | ^3.2.45 | MIT | |
| 3.1.0-beta.0 | ^3.2.45 | MIT | |
| 3.0.0-next.5 | ^3.2.45 | MIT | |
| 3.0.0-next.4 | ^3.2.45 | MIT | |
| 3.0.0-next.3 | ^3.2.45 | MIT | |
| 3.0.0-next.2 | ^3.2.45 | MIT | |
| 3.0.0-next.1 | ^3.2.45 | MIT | |
| 3.0.0-next.0 | ^3.2.45 | MIT | |
| 2.2.0-beta.3 | ^2.6.14 | MIT | |
| 2.2.0-beta.2 | ^2.6.14 | MIT | |
| 2.2.0-beta.1 | ^2.6.14 | MIT | |
| 2.2.0-beta.0 | ^2.6.14 | MIT | |
| 2.1.0-beta.0 | ^2.6.14 | MIT | |
| 2.0.0-beta.2 | ^2.6.14 | MIT |