n-discrete

Create discrete Naive UI APIs for use outside Vue component setup.

8|3|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/jiaiyan/naive-ui-skills --skill n-discrete
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: n-discrete
Source: https://github.com/jiaiyan/naive-ui-skills/tree/main/components/n-discrete
Command: npx skills add https://github.com/jiaiyan/naive-ui-skills --skill n-discrete

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It enables calling Naive UI APIs outside Vue component setup by providing a discrete API creator function that returns isolated, globally accessible APIs.

Core Features & Use Cases

  • Outside-setup API access for message, dialog, notification, loadingBar, and modal
  • Simple integration with typical app architectures and utility modules
  • Safer, unmountable lifecycle to clean up resources when no longer needed

Quick Start

Import createDiscreteApi and demonstrate a simple outside-setup usage with a minimal example.

Frequently Asked Questions about n-discrete

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I call Naive UI message and dialog APIs outside of a Vue component setup?▼

To call Naive UI APIs outside a Vue component setup, import createDiscreteApi. It returns isolated, globally accessible message, dialog, notification, loadingBar, and modal objects for use in utility modules.

Can I use Naive UI notification and loadingBar in utility files without a component context?▼

Yes, you can use Naive UI notification and loadingBar in utility files. The discrete API creates an isolated app context allowing global access to these UI APIs from any non-component code.

What is the best way to globally access Naive UI modal APIs across my Vue application?▼

The best way to globally access Naive UI modal APIs is using createDiscreteApi. It generates a standalone object containing modal and other UI APIs, bypassing the need for component-level injections.

Does createDiscreteApi support unmounting to clean up resources when APIs are no longer needed?▼

Yes, createDiscreteApi supports a safer, unmountable lifecycle. The returned object includes an unmount function to properly clean up resources and the isolated app context when no longer needed.

When do I need discrete APIs for Naive UI instead of standard component injections?▼

You need discrete APIs for Naive UI when triggering messages or dialogs from non-component code. Standard injections require a setup context, whereas discrete APIs provide global access for utilities.

Are there limitations to calling Naive UI APIs outside setup using the discrete API approach?▼

A limitation of calling Naive UI APIs outside setup is that createDiscreteApi creates a separate app context. You must manage this isolated context and manually call unmount to clean up resources.