Skip to content

Commit

Permalink
Update useField docs with options (#4626)
Browse files Browse the repository at this point in the history
Added a simple description of how to use options with useField
  • Loading branch information
JalenWasHere committed Jan 15, 2024
1 parent 61f86ea commit b96155c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions docs/src/pages/api/use-field.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -356,3 +356,41 @@ checked.value; // true or false
```

For more information on how you might use the `checked` property, check the [custom checkboxes example](/examples/custom-checkboxes).

## Additional options

To pass additional configuration to your fields you can use more options.

```vue
<template>
<div>
<input v-model="value" />
<span>{{ errorMessage }}</span>
</div>
</template>
<script setup>
import { useField } from 'vee-validate';
// a simple `company` field with some options passed into it
const { value, errorMessage } = useField('company', ..., {
label: 'Your company',
type: 'text',
initialValue: ''
});
</script>
```

| Field options |
|----------------------------------------|
| `type` |
| `label` |
| `initialValue` |
| `validateOnMount` |
| `bails ` |
| `standalone` |
| `validateOnValueUpdate` |
| `keepValueOnUnmount` |
| `syncVModel` |
| `checkedValue` (checkbox/radio only) |
| `uncheckedValue` (checkbox/radio only) |

0 comments on commit b96155c

Please sign in to comment.