Company logo
March 22, 2021

Use custom icons in object search

Richard Freling's avatar
Vinay Ayyala's avatar

Want to show an avatar or other icons next to Quickfind records? Now you can!

Take a look at the following example: all we have to do is add an icon property for our record array.

const cereals = [
  {
    label: 'Trix',
    value: 'trix',
    icon: '🐰',
  },
  {
    label: 'Lucky Charms',
    value: 'luckyCharms',
    icon: 'πŸ€',
  },
  {
    label: 'Cookie Crisp',
    value: 'cookieCrisp',
    icon: 'πŸͺ',
  }
];
window.CommandBar.addContext("cereals", cereals);

How can I turn this on? πŸ› 

Set the icon property for records in context as illustrated above.