npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@xyz/nuxt-confirm

v1.0.4

Published

A promise-based confirmation dialog module for Nuxt applications that provides customizable, accessible modal confirmations

Readme

Nuxt Confirm

npm version npm downloads License Nuxt

A promise-based, customizable confirmation dialog system for Nuxt 3 applications that simplifies user interactions with elegant UI components.

Features

  • 🎨 Fully customizable UI with Nuxt UI integration
  • 🔄 Promise-based API for easy use in async functions
  • 🎭 Multiple preset styles (info, warning, danger, success)
  • 🔄 Seamless compatibility with both Nuxt UI v2 and v3
  • 🌙 Dark mode support out of the box
  • 🧩 TypeScript support for improved developer experience

Quick Setup

Install the module to your Nuxt application with one command:

# npx
npx nuxi module add @xyz/nuxt-confirm

# npm
npm install @xyz/nuxt-confirm 

# yarn
yarn add @xyz/nuxt-confirm

# pnpm
pnpm add @xyz/nuxt-confirm

# bun
bun add @xyz/nuxt-confirm

Setup

Add @xyz/nuxt-confirm to the modules section of your nuxt.config.ts:

export default defineNuxtConfig({
  modules: ['@xyz/nuxt-confirm'],
  confirm: {
    // Module options
    version: 2, // 2 or 3 depending on your Nuxt UI version
    type: 'danger', // default type for confirmations
    size: 'md', // default size
    autoImport: true, // auto import the composable
    bgClass: 'bg-white dark:bg-black', // background class for the dialog
  }
})

Usage

Basic Usage

Simply use the useConfirm composable to show confirmation dialogs:

<template>
  <div>
    <UButton @click="confirmDelete">Delete Item</UButton>
  </div>
</template>

<script setup>
const { confirm } = useConfirm();

const confirmDelete = async () => {
    const confirmed = await confirm({
      title: 'Delete Item',
      message: 'Are you sure you want to delete this item?',
      confirm: 'Yes, Delete',
      cancel: 'No, Cancel',
      type: 'danger'
    })

    // User confirmed the action
    if (confirmed) {
      console.log('Item deleted')
    }
    else {
      console.log('Deletion cancelled')
    }
}
</script>

Advanced Usage

Customize every aspect of the confirmation dialog:

<template>
  <div>
    <UButton @click="confirmAction">Perform Action</UButton>
  </div>
</template>

<script setup>
const { confirm } = useConfirm();

const confirmAction = async () => {
  const confirmed = await confirm({
    title: 'Confirm Action',
    message: 'Are you sure you want to perform this action?',
    type: 'info',
    icon: {
      name: 'i-heroicons-question-mark-circle',
      color: 'blue',
      size: 'md'
    },
    confirm: {
      label: 'Yes, Continue',
      color: 'blue',
      size: 'md',
      variant: 'solid'
    },
    cancel: {
      label: 'Cancel',
      color: 'gray',
      size: 'md',
      variant: 'outline'
    },
  })
  
  // Action confirmed
  if (confirmed) {
    console.log('Action confirmed')
  }
  else {
    console.log('Action cancelled')
  }
}
</script>

Using Different Types

The module comes with preset types that apply different styles:

// Success confirmation
const confirmed = await confirm({
  title: 'Success',
  message: 'Operation completed successfully',
  type: 'success',
  confirm: 'OK'
})

// Warning confirmation
const confirmed = await confirm({
  title: 'Warning',
  message: 'This action may have consequences',
  type: 'warning',
  confirm: 'Proceed',
  cancel: 'Cancel'
})

// Info confirmation
const confirmed = await confirm({
  title: 'Information',
  message: 'Here is some important information',
  type: 'info',
  confirm: 'Got it'
})

Configuration

Module Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | version | 2 \| 3 | 3 | The Nuxt UI version to use | | type | 'info' \| 'warning' \| 'danger' \| 'success' | 'danger' | Default type for confirmations | | size | 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' | 'md' | Default size for the dialog | | bgClass | string | 'bg-white dark:bg-black' | Additional background classes | | autoImport | boolean | true | Whether to auto-import the composable |

Dialog Options

| Option | Type | Description | |--------|------|-------------| | type | 'info' \| 'warning' \| 'danger' \| 'success' | Dialog type (applies default styles) | | title | string | Dialog title | | message | string | Dialog message | | icon | { name: string, color: string, size?: string } | Icon configuration | | confirm | string \| { label: string, color: string, size?: string, variant?: string } | Confirm button configuration | | cancel | string \| { label: string, color: string, size?: string, variant?: string } \| false | Cancel button configuration (set to false to hide) |

TypeScript Support

The module includes full TypeScript definitions:

import type { ConfirmOptions } from '@xyz/nuxt-confirm'

const options: ConfirmOptions = {
  title: 'Confirm Action',
  message: 'Are you sure?',
  type: 'warning'
}

Contribution

We welcome contributions to improve Nuxt Confirm! Please feel free to submit issues and pull requests.

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

License

MIT License