vael-ui v0.5.7

Forms guide · 8 of 8

Nuxt and server rendering

A module for Nuxt, ids that match between server and browser, and the same API in Vapor.

The Nuxt module

The module installs the plugin, connects @nuxtjs/i18n in whichever order the modules run, and auto-imports useForm, useFormContext, useField and msg. Its options are showErrors, keyPrefix, i18n and autoImports.

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nuxtjs/i18n', 'vael-form/nuxt'],
  vaelForm: { showErrors: 'edited' },
})

Server rendering

Inputs get their ids from useId(), so the server and the browser agree. A server render shows no errors, since nobody has earned them yet. A form outside a component needs an id of its own.

Vapor

The same API works in Vapor components and in Vapor inside a VDOM app, tested in both. Vue has no Vapor server renderer yet, so server rendering is tested for VDOM only.