I have a requirement that, by passing a name, it should return an avatar icon which contains the first letters of the words contained in that name. For instance: if I pass
Since UI5 1.46.x, such avatar icon controls are available out of the box.
* sap.f
if UI5 version is lower than 1.73. Otherwise, use the Avatar
from sap.m
instead!
createInitials: function(name) { // minimal sample
return name.split(" ").map(str => str[0]).join("");
},
More samples can be found in https://openui5.hana.ondemand.com/entity/sap.m.Avatar.