Skip to content

Nuxt

Adding the Nuxt module enables auto-imports for selected exports.

Run the following command in your Nuxt application:

sh
pnpm add @regle/core @regle/rules @regle/nuxt
sh
npm install @regle/core @regle/rules @regle/nuxt
sh
yarn add @regle/core @regle/rules @regle/nuxt
sh
bun add @regle/core @regle/rules @regle/nuxt

You can then declare the module inside your nuxt.config.ts.

nuxt.config.ts
ts
export default defineNuxtConfig({
  modules: ['@regle/nuxt']
})

Auto imports

The following exports will become globally available in your Nuxt application:

  • @regle/core
    • useRegle
    • createRule
    • defineRegleConfig
    • inferRules
  • @regle/rules Note: Built-in rules are not auto-injected to minimize the risk of name conflicts.
    • withAsync
    • withMessage
    • withParams
    • withTooltip
  • @regle/zod (if present)
    • useZodRegle
  • @regle/valibot (if present)
    • useValibotRegle

Released under the MIT License. Logo by Johannes Lacourly