Skip to main content

Components

Nuxt Kit provides a set of utilities to help you work with components. You can register components globally or locally, and also add directories to be scanned for components. Components are the building blocks of your Nuxt application. They are reusable Vue instances that can be used to create a user interface.

addComponentsDir

Register a directory to be scanned for components and imported only when used. Keep in mind, that this does not register components globally, until you specify global: true option.

Type

Parameters

dir: An object with the following properties: opts:

Usage

addComponent

Register a component to be automatically imported.

Type

Parameters

options: An object with the following properties:

Usage

Auto-importing from npm packages

If you want to auto-import a component from an npm package, and the component is a named export (rather than the default), you can use the export option.

Source

View source on GitHub