Skip to content

Commit

Permalink
docs: updated doc example to use toRef
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Mar 27, 2022
1 parent 5e55365 commit 67c2455
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/content/examples/custom-checkboxes.md
Expand Up @@ -23,6 +23,7 @@ With all of that in mind, vee-validate offers simple abstractions for checkboxes
Because `useField` isn't aware of what kind of input will be composed with it, you will need to specify that the input is of type `checkbox` and pass a `checkedValue` as well which represents that single field's value. By doing so, you gain access to `checked` prop which tells you if the checkbox should be selected.

```js
import { toRef } from 'vue';
import { useField } from 'vee-validate';

export default {
Expand All @@ -44,7 +45,8 @@ export default {
},
},
setup(props) {
const { checked, handleChange } = useField(props.name, props.rules, {
// Must use `toRef` to make the checkboxes names reactive
const { checked, handleChange } = useField(toRef(props.name), props.rules, {
// 👇 These are important
type: 'checkbox',
checkedValue: props.value,
Expand Down

0 comments on commit 67c2455

Please sign in to comment.