ComboBox and slots / exposed props

1 Answer 35 Views
ComboBox
Dan
Top achievements
Rank 1
Iron
Dan asked on 14 Jun 2024, 12:04 AM

Hi there, I was wondering if there is any exposed props or any way to change the way the default list items look when rendering. 

What I am trying to achieve is each item showing a background color of the value of the data-item.

Essentially this


          <combo-box
            :data-items="sports"
          >
            <template #item="{ props }">
              <div :style="`background: ${props.item}`">
                {{ props.item }}
              </div>
            </template>
          </combo-box>

Dan
Top achievements
Rank 1
Iron
commented on 14 Jun 2024, 12:07 AM | edited

Please ignore my question. 

1 Answer, 1 is accepted

Sort by
0
Accepted
Dan
Top achievements
Rank 1
Iron
answered on 14 Jun 2024, 12:13 AM | edited on 14 Jun 2024, 12:15 AM

I found the correct way to do it by looking at the documentation for DropDownList,

<combo-box :data-items="sports" item-render="itemRender">
<template #itemRender="{ props }">
{{ props }}
</template>
</combo-box>
Vessy
Telerik team
commented on 14 Jun 2024, 06:30 AM

Thanks a lot for sharing the found solution with the community, Dan!
Tags
ComboBox
Asked by
Dan
Top achievements
Rank 1
Iron
Answers by
Dan
Top achievements
Rank 1
Iron
Share this question
or