InputArray
Features
Add items
onKeyDownenterDelete items
onKeyDownbackspaceAnimated
shakenotifies the user if they try to break requiredmin/maxarray itemsThe value returned by the field is an array
[...]

Don't forget to $cast the field to array on the Model
InputArray::make('Utterances', 'utter')
->type('text') //any html5 type except 'search' and 'range'
->minItems(2) //Minimum items allowed
->maxItems(4) //Max items allowed
->placeholder('Utter something')
//->deferEntangle(false) //uncomment to validate on every keystroke!! (NOT recommended)
->rules('required|string'); //the rules apply to each input fieldThe errorClass is applied to the outer div surrounding the inputs on validation error
Methods
->type(string $type)
Use any HTML5 input type except
searchandrange.
->placeholder(string $type)
Applied to each input.
->showEmptyItem($count = 1)
Define how many empty items you want to show as default.
Please note that this option has nothing to do with validation! If you show empty fields and set the field to be required, it might be confusing to the user when they get an error when they submit the form.
->deferEntangle(bool $state = true)
Not recommended to set this option to false because it will sync the field value, on every keystroke.
->minItems(int $min = 1)
Require minimum items, prevents the user from deleting input items.
->maxItems(int $max = 0)
Allow max items, prevents the user from adding input items.
0equals no limitation
Last updated
Was this helpful?