Skip to content

Commit 0290f98

Browse files
committed
docs: Add example for custom global FormKit Configuration
1 parent 5106627 commit 0290f98

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,33 @@ That's it! You can now use FormKit PrimeVue Nuxt Module in your Nuxt app ✨
3535
- **formkitPluginAnimate** (default: `true`): Enable FormKit animate plugin (Only hen formkitAutoConfig is `true`).
3636
- **formkitPluginAsterisk** (default: `true`): Enable FormKit asterisk plugin (Only hen formkitAutoConfig is `true`).
3737

38+
### Custom Global FormKit Configuration
39+
40+
You can also provide a custom FormKit configuration by adding the following configuration to your `nuxt.config.ts`:
41+
42+
```ts
43+
formkitPrimevue: {
44+
formkitAutoConfig: false
45+
}
46+
```
47+
48+
and creating a custom nuxt plugin in the `plugins` directory:
49+
50+
for example `plugins/formkit.ts`:
51+
```ts
52+
import { defaultConfig, plugin } from '@formkit/vue'
53+
import { primeInputs, primeOutputs } from '@sfxcode/formkit-primevue'
54+
55+
export default defineNuxtPlugin((nuxtApp) => {
56+
// Doing something with nuxtApp
57+
const app = nuxtApp.vueApp
58+
app.use(plugin, defaultConfig({
59+
inputs: { ...primeInputs, ...primeOutputs },
60+
// ... additional configurations like locales, plugins, custom validations etc.
61+
}))
62+
})
63+
64+
````
3865
## Additional Configuration
3966

4067
For i18n support, you can add the following configuration to your `nuxt.config.ts`:

0 commit comments

Comments
 (0)