Configuration
Configuration
nuxt-x-app-formkit has no app.config.ts keys — all component behavior is controlled via props. Configuration is limited to installation setup, an optional FormKit theme, and an optional FormKit Pro key.
nuxt.config.ts
export default defineNuxtConfig({
modules: ['@nuxt/ui'], // required peer — provides UModal/USlideover/useToast
extends: ['@xenterprises/nuxt-x-app-formkit']
})
The layer registers @formkit/nuxt itself (autoImport: true) and points it at its own bundled formkit.config.ts, which wires genesis icons and the custom fileUpload input.
@xenterprises/nuxt-x-formkit as a required base layer. That package is archived — it was renamed to @xenterprises/nuxt-x-app-formkit, which now bundles the FormKit configuration itself. Do not extend both.Peer Dependencies
| Package | Range | Required |
|---|---|---|
nuxt | ^4.0.0 | Yes |
@nuxt/ui | ^4.0.0 | Yes (or extend @xenterprises/nuxt-x-app, which provides it) |
@formkit/pro | >=0.127.24 <0.129.0 | Optional — FormKit Pro only |
The @formkit/pro range is the FormKit 1.x line: 0.128.0 is the last release compatible with the layer's @formkit/nuxt ^1.7.2; 0.129.0+ requires FormKit 2.x.
FormKit Theme (consumer-provided)
The layer ships no theme. To style FormKit inputs, generate a theme with the FormKit CLI and wire it in your own formkit.config.ts, spreading the layer's named xFormkitConfig export so the fileUpload input and genesis icons stay registered:
// formkit.config.ts (consumer project root)
import { defineFormKitConfig } from '@formkit/vue'
import { xFormkitConfig } from '@xenterprises/nuxt-x-app-formkit/formkit.config'
import { rootClasses } from './formkit.theme'
export default defineFormKitConfig({
...xFormkitConfig, // genesisIcons + the custom fileUpload input
config: { rootClasses },
})
// nuxt.config.ts
export default defineNuxtConfig({
formkit: { configFile: './formkit.config.ts' }
})
formkit.config.tsoverrides the layer's bundled config — spread xFormkitConfig into it (as above) or <FormKit type="fileUpload"> will throw "Unknown input type". Do not re-register fileUpload + genesisIcons manually; the named export exists exactly for this.For Tailwind CSS v4, add the theme file as a source in your main CSS so its classes are generated:
/* app/assets/css/main.css */
@import "tailwindcss";
@source "./formkit.theme.ts";
Environment Variables
| Variable | Required | Description |
|---|---|---|
FORMKIT | No | FormKit Pro key. Must start with fk-. Read at build time — see below. |
FormKit Pro key behavior (build time)
The FORMKIT key is evaluated when Nuxt builds, not at runtime. During configuration the layer picks which FormKit config file to point @formkit/nuxt at:
- No
FORMKIT, key not starting withfk-, or@formkit/pronot installed → the layer uses its bundledformkit.config.ts(genesis icons +fileUploadonly); a warning is logged in the invalid-key/missing-package cases. - Valid
fk-…key present at build and@formkit/proinstalled → the layer swaps to its bundledformkit.config.pro.ts, which spreadsxFormkitConfigand registerscreateProPlugin(key, proInputs)— all Pro inputs become available.
Because the swap happens at build time, adding or changing the key requires a rebuild; setting it only at runtime has no effect.
API endpoints are passed directly as the endpoint prop on each component instance — no runtime config needed.
Component Defaults
All per-instance defaults are set via props. Common ones to configure at the call site:
| Prop | Default | Override on |
|---|---|---|
size | "md" | XFormModal |
side | "right" | XFormSlide |
showToast | true | Both |
closeOnSuccess | true | Both |
resetOnClose | true | Both |
dropzone | true | XFormFileUpload |
AI Context
package: "@xenterprises/nuxt-x-app-formkit"
config-key: none
peers: { nuxt: ^4.0.0, "@nuxt/ui": ^4.0.0, "@formkit/pro": ">=0.127.24 <0.129.0 (optional)" }
env: FORMKIT=fk-... (optional FormKit Pro key, auto-loaded when @formkit/pro installed)
theme: consumer provides formkit.theme.ts + own formkit.config.ts (rootClasses); add @source in Tailwind v4 CSS
use-when: Configuring nuxt-x-app-formkit layer — all component behavior is prop-driven, no app.config.ts keys
