Making the Avatar (slot=profile) and primaryTitle in ShellBar a link
Describe the documentation issue
- [ ] Documentation is unclear
- [ ] Documentation is missing
- [ ] Other
Description of the issue
Is there an easy way to make the Avatar in ShellBar component a link?
I also want to make Primary Title and Secondary Title links. Is there an easy way?
Is there documentation around the base set of properties of every component?
Thanks
Hi @ansujohn
If you have the following HTML:
<ui5-shellbar
primary-title="Corporate Portal"
secondary-title="secondary title"
>
<ui5-avatar slot="profile" image="../../../assets/images/avatars/woman_avatar_5.png"></ui5-avatar>
</ui5-shellbar>
If you want to use the profile slot as link, you have to do the following(actual code might differ based on the used framework):
document.querySelector("ui5-shellbar").addEventListener("profile-click", event => {
// Do the navigation here
});
When it comes to the primary title, it is not intended to be used as a link. What you can do with the primary title, is make it open a popover by providing the menuItems slot. For example:
<ui5-shellbar
primary-title="Corporate Portal"
>
<ui5-li slot="menuItems">Application 1</ui5-li>
<ui5-li slot="menuItems">Application 2</ui5-li>
<ui5-li slot="menuItems">Application 3</ui5-li>
<ui5-li slot="menuItems">Application 4</ui5-li>
<ui5-li slot="menuItems">Application 5</ui5-li>
</ui5-shellbar>
Lastly, when it comes to the secondary title, it is not active in any way by design, so you can't use it as link.