Skip to content

Commit

Permalink
docs: docs work
Browse files Browse the repository at this point in the history
  • Loading branch information
YannicEl committed Aug 9, 2023
1 parent 9045d12 commit 7433eaa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/docs/core-concepts/validators.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Native validators

When applicable `@vuetils/form` will use [native web valdiators](https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation#using_built-in_form_validation) like `required` or `minLength`. Try submitting the form in an invalid state and depending on your platform and browser a native validation warnign will appear.

## Additional validators

## Write your own validator
9 changes: 8 additions & 1 deletion packages/docs/introduction/Test.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,21 @@
</template>

<script setup>
import { UField, UForm, required, useForm } from '@vuetils/form';
import { UField, UForm, definePlugin, required, useForm } from '@vuetils/form';
const form = useForm({
test: ['hallo', [required]],
test2: [''],
select: ['drallo'],
});
const plugin = definePlugin((form, args) => {
console.log(args);
console.log(form);
});
form.addPlugin(plugin({ hello: 'world' }));
function onSubmit() {
console.log('on submit');
}
Expand Down
2 changes: 0 additions & 2 deletions packages/docs/introduction/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ const form = useForm({

The rendered form will look something like this. Play around with it and see how the errors and state change while you are typing.

When applicable `@vuetils/form` will use [native web valdiators](https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation#using_built-in_form_validation) like `required` or `minLength`. Try submitting the form in an invalid state and depending on your platform and browser a native validation warnign will appear.

<script setup>
import GettingStarted from './GettingStarted.vue'
</script>
Expand Down

0 comments on commit 7433eaa

Please sign in to comment.