mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-03 14:23:12 +02:00
Improve callbackOnCreateTemplates
example (#647)
Shows how to add the placeholder class(es) when the item is the placeholder.
This commit is contained in:
parent
7de0887e7d
commit
31ef5bb065
|
@ -551,7 +551,7 @@ const example = new Choices(element, {
|
||||||
return {
|
return {
|
||||||
item: (classNames, data) => {
|
item: (classNames, data) => {
|
||||||
return template(`
|
return template(`
|
||||||
<div class="${classNames.item} ${data.highlighted ? classNames.highlightedState : classNames.itemSelectable}" data-item data-id="${data.id}" data-value="${data.value}" ${data.active ? 'aria-selected="true"' : ''} ${data.disabled ? 'aria-disabled="true"' : ''}>
|
<div class="${classNames.item} ${data.highlighted ? classNames.highlightedState : classNames.itemSelectable} ${data.placeholder ? classNames.placeholder : ''}" data-item data-id="${data.id}" data-value="${data.value}" ${data.active ? 'aria-selected="true"' : ''} ${data.disabled ? 'aria-disabled="true"' : ''}>
|
||||||
<span>★</span> ${data.label}
|
<span>★</span> ${data.label}
|
||||||
</div>
|
</div>
|
||||||
`);
|
`);
|
||||||
|
|
Loading…
Reference in a new issue