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 {
|
||||
item: (classNames, data) => {
|
||||
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}
|
||||
</div>
|
||||
`);
|
||||
|
|
Loading…
Reference in New Issue