Suggest
Suggest control
Parameters you can pass
Parameters | Data type | Description |
---|---|---|
name | string | Name of input that will be used in the form |
id | string | Hidden input ID (stores the value) |
items | array of obj | Array of Suggest values |
selected | string | ID of selected value from items array |
class_name | string | Wrapper class (if several classes passed, divide them by Space) |
placeholder | string | Placeholder |
disabled | boolean | Shows if it's disabled |
Parameters of items
Parameter | Data type | Description |
---|---|---|
id | string | ID of the value that will be pasted into the data-attribute data-value-id of the input |
value | string | Value (text) |
custom_class | string | Custom Suggest element class |
Default
self.render({ ref: '/tmpl/controls/suggest.twig' }, {
name: 'animal',
items: [
{ id: 1, value: 'Cat' },
{ id: 2, value: 'Dog' },
],
class_name: 'my-custom-suggest'
});
Selected
self.render({ ref: '/tmpl/controls/suggest.twig' }, {
name: 'animal',
items: [
{ id: 1, value: 'Cat', custom_class: 'custom-classname-if-needed' },
{ id: 2, value: 'Dog' },
],
class_name: 'my-custom-suggest',
selected: 2
});
Updated 2 months ago