diff --git a/docs/formBuilder/options/onAddOption.md b/docs/formBuilder/options/onAddOption.md new file mode 100644 index 000000000..1b1fd44cd --- /dev/null +++ b/docs/formBuilder/options/onAddOption.md @@ -0,0 +1,16 @@ +# onAddOption + +transform the optionTemplate by return a modified template using the `onAddOption` + +## Usage + +```javascript +const options = { + onAddOption: (optionTemplate, optionIndex) => { + optionTemplate.label = `Option ${optionIndex + 1}` + optionTemplate.value = `option-${optionIndex + 1}` + return optionTemplate + }, +} +$(container).formBuilder(options) +```