Skip to content

Commit 2e1d662

Browse files
committed
docs: nuxt module config
1 parent 2b4a451 commit 2e1d662

File tree

2 files changed

+104
-4
lines changed

2 files changed

+104
-4
lines changed

docs/src/pages/integrations/nuxt.mdx

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import DocTip from '@/components/DocTip.vue';
1212
<div class="mb-10 w-full flex items-center justify-center">
1313
<img class="h-40" src="https://github.com/logaretm/vee-validate/raw/main/logo.png" />
1414

15-
<a class="ml-4" href="https://nuxt.com/" target="_blank">
16-
<img class="h-40" src="https://nuxt.com/assets/design-kit/logo/full-logo-green-dark.png" />
15+
<a class="ml-20" href="https://nuxt.com/" target="_blank">
16+
<img class="h-40" src="https://nuxt.com/assets/design-kit/logo/icon-green.svg" />
1717
</a>
1818
</div>
1919

@@ -31,7 +31,7 @@ Official vee-validate's Nuxt module
3131
- Auto import of vee-validate composables
3232
- Detecting if you are using `zod` or `yup` and exposing the `toTypedSchema` suitable for either.
3333

34-
<DocTip type="warning">
34+
<DocTip type="warn">
3535

3636
No types are exposed by default to avoid having conflicts with other libraries, aside from vee-validate's main API components/composables. You can still import them via `vee-validate`.
3737

@@ -63,3 +63,53 @@ export default defineNuxtConfig({
6363
],
6464
});
6565
```
66+
67+
## Configuration
68+
69+
You can configure a few aspects of the `@vee-validate/nuxt` module. Here is the config interface:
70+
71+
```ts{3-19}
72+
export default defineNuxtConfig({
73+
// ...
74+
modules: [
75+
//...
76+
[
77+
'@vee-validate/nuxt',
78+
{
79+
// disable or enable auto imports
80+
autoImports: true,
81+
// Use different names for components
82+
componentNames: {
83+
Form: 'VeeForm',
84+
Field: 'VeeField',
85+
FieldArray: 'VeeFieldArray',
86+
ErrorMessage: 'VeeErrorMessage',
87+
},
88+
},
89+
],
90+
],
91+
});
92+
```
93+
94+
You can also use the `veeValidate` config key instead of the array syntax:
95+
96+
```ts{7-16}
97+
export default defineNuxtConfig({
98+
// ...
99+
modules: [
100+
//...
101+
'@vee-validate/nuxt',
102+
],
103+
veeValidate: {
104+
// disable or enable auto imports
105+
autoImports: true,
106+
// Use different names for components
107+
componentNames: {
108+
Form: 'VeeForm',
109+
Field: 'VeeField',
110+
FieldArray: 'VeeFieldArray',
111+
ErrorMessage: 'VeeErrorMessage',
112+
},
113+
},
114+
});
115+
```

packages/nuxt/README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</a>
77

88
<a href="https://nuxt.com/" target="_blank">
9-
<img width="150" src="https://nuxt.com/assets/design-kit/logo/full-logo-green-dark.png">
9+
<img width="150" src="https://nuxt.com/assets/design-kit/logo/icon-green.svg">
1010
</a>
1111
</p>
1212

@@ -56,3 +56,53 @@ export default defineNuxtConfig({
5656
## Types
5757

5858
No types are exposed by default to avoid having conflicts with other libraries, aside from vee-validate's main API components/composables. You can still import them via `vee-validate`.
59+
60+
## Configuration
61+
62+
You can configure a few aspects of the `@vee-validate/nuxt` module. Here is the config interface:
63+
64+
```ts
65+
export default defineNuxtConfig({
66+
// ...
67+
modules: [
68+
//...
69+
[
70+
'@vee-validate/nuxt',
71+
{
72+
// disable or enable auto imports
73+
autoImports: true,
74+
// Use different names for components
75+
componentNames: {
76+
Form: 'VeeForm',
77+
Field: 'VeeField',
78+
FieldArray: 'VeeFieldArray',
79+
ErrorMessage: 'VeeErrorMessage',
80+
},
81+
},
82+
],
83+
],
84+
});
85+
```
86+
87+
You can also use the `veeValidate` config key instead of the array syntax:
88+
89+
```ts
90+
export default defineNuxtConfig({
91+
// ...
92+
modules: [
93+
//...
94+
'@vee-validate/nuxt',
95+
],
96+
veeValidate: {
97+
// disable or enable auto imports
98+
autoImports: true,
99+
// Use different names for components
100+
componentNames: {
101+
Form: 'VeeForm',
102+
Field: 'VeeField',
103+
FieldArray: 'VeeFieldArray',
104+
ErrorMessage: 'VeeErrorMessage',
105+
},
106+
},
107+
});
108+
```

0 commit comments

Comments
 (0)