Skip to content

Commit 76cd8fd

Browse files
committed
docs: document data-toggle-checkbox
1 parent 4c5dbeb commit 76cd8fd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/basic-usage/conditional-wrapper.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,15 @@ The conditional wrapper supports the following attributes:
2222
- `'hide-fields'` - Whether the fields should also be hidden when they are disabled. Default is `false`.
2323
- `'disable'` - Setting this to `true` will invert the behaviour. i.e The section will get disabled if the given value is selected.
2424
- `'json-encode'` - Whether to json encode the given value. Default is `true` if the given value is an array, otherwise it's false.
25+
26+
27+
## Disabling an input field depending on a checkbox status
28+
Sometimes, you may want to disable a if a checkbox is checked. This can be done using the `data-toggle-checkbox` attribute.
29+
This attribute should be set to the selector of the input field you want to disable.
30+
31+
In this example, we will disable the `max_salary` input field if the `any_max_salary` checkbox is checked.
32+
33+
```html
34+
<x-forms::number name="max_salary" label="Max Salary" />
35+
36+
<x-forms::checkbox name="any_max_salary" :value="1" data-toggle-checkbox="#max-salary" />

0 commit comments

Comments
 (0)