Change categoryLabel value in currentRefinements widget

I’m using the currentRefinements widget with Vanilla JS instantsearch.js and I’m trying to change the category label value.

The currentRefinements widget has a transformItems function but not much documentation so I’m unsure how to change the labels using this function.

The only example in the docs is to put all the labels in uppercase but when I try the example code as a starting point it doesn’t work. (Uncaught TypeError: Cannot read property ‘toUpperCase’ of undefined)

Creating my own UI just to change some label value also seems like a bit of overkill.

Hi @steven.vandemoortele,

Here is a sample:

Select a brand filter.

You will see that we used transformItems to change the label and you can also do the same, as you wish.

I hope this helps!

Hi @ajay.david, thank you for the code sample.
The same code in transformItems did not work, but it appears to be a bug in the version of instantsearch.js that I was using.

The building search ui docs tells you to use instantsearch.js@3.0.0 but the sample code for transformItems doesn’t work in 3.0.0, it does work in version 3.1.1 that you’re using in your example.