You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

vuetify-use-dialog

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vuetify-use-dialog

> Confirming user choice is a good thing to do, it should also be easy to do.

0.6.11
latest
Source
npmnpm
Version published
Weekly downloads
751
-31.91%
Maintainers
1
Weekly downloads
 
Created
Source

vuetify-use-dialog

Confirming user choice is a good thing to do, it should also be easy to do.

A module that simplifies the creation of dialogs and snackbars in Vuetify.

Demo: StackBlitz

Installation

npm install vuetify-use-dialog

Usage

Install the plugin (after vuetify)

import { createApp } from 'vue'
import { createVuetify } from 'vuetify'
import VuetifyUseDialog from 'vuetify-use-dialog'

import App from './App.vue'

const app = createApp(App)
const vuetify = createVuetify()

app.use(vuetify)
app.use(VuetifyUseDialog)

app.mount('#app')

Call the useConfirm or useSnackbar composable anywhere:

<script setup lang="ts">
import { useConfirm, useSnackbar } from 'vuetify-use-dialog'

const createConfirm = useConfirm()
const createSnackbar = useSnackbar()

async function handleConfirm() {
  const isConfirmed = await createConfirm({ content: 'This action is permanent!' })

  if (!isConfirmed)
    return

  createSnackbar({ text: 'Confirmed' })
}
</script>

<template>
  <VBtn @click="handleConfirm">
    Confirm
  </VBtn>
</template>

Check this if you're using Options API.

Options

useConfirm

NameTypeDefaultDescription
titlestring'Are you sure?'Dialog title.
titleComponentComponentCustom title component.
titleComponentPropsobject{}Custom title component props.
contentstring''Dialog content.
contentComponentComponentCustom content component.
contentComponentPropsobject{}Custom content component props.
confirmationTextstring'Ok'Confirmation button caption.
cancellationTextstring'Cancel'Cancellation button caption.
dialogPropsobject{}VDialog props.
cardPropsobject{}VCard props.
confirmationButtonPropsobject{}VBtn props for the confirmation button.
cancellationButtonPropsobject{}VBtn props for the cancellation button.
cardTitlePropsobject{}VCardTitle props for the dialog title.
cardTextPropsobject{}VCardText props for the dialog content.
confirmationKeywordstringundefinedIf provided the confirmation button will be disabled by default and an additional textfield will be rendered. The confirmation button will only be enabled when the contents of the textfield match the value of confirmationKeyword.
confirmationKeywordTextFieldPropsobject{}VTextField props for the confirmation keyword textfield.
cardActionsPropsobject{}VCardActions props.
actionsContentComponentComponent{}Custom actions content component.

useSnackbar

NameTypeDefaultDescription
textstring''Snackbar text.
snackbarPropsobject{}VSnackbar props.
showCloseButtonbooleantrueShow the close button.
closeButtonTextstring'Close'Close button text
closeButtonPropsobject{}VBtn props.

Global options:

app.use(VuetifyUseDialog, {
  confirmDialog: {
    // useConfirm options
    title: 'Are you sure?'
  },
  snackbar: {
    // useSnackbar options
    snackbarProps: {
      timeout: 2000,
    }
  }
})

Looking for a stackable toast component? Check out Vuetify Sonner.

License

MIT

Keywords

vuetify

FAQs

Package last updated on 10 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.