Closed paoloproni closed 3 years ago
Hello, thank you for your answer. I wonder if I can do it with the web components. It seems to me that the example is in React.
Are you building a site for IBM.com or are you building a product? @paoloproni
I am building a personal project. I can call it a product. I would like to use Web components. Actually I wrap them with some custom Vue components, as I do not feel very comfortable with the supplied Vue components, but I do not know React, unfortunately.
Closing, based on comments above.
As this page shows, the code for App Switcher is avail in React, Vue and Angular. It isn't avail in Web components at this time https://www.carbondesignsystem.com/components/UI-shell-header/code
Here is an example layout component made with lit 2:
Things relevant to your question:
<div id="header-global">
<bx-btn kind="ghost"
>${unsafeHTML(UserAvatar20().strings.join(''))}</bx-btn
>
<bx-btn kind="ghost"
>${unsafeHTML(AppSwitcher20().strings.join(''))}</bx-btn
>
</div>
#header-global {
margin-inline-start: auto;
display: flex;
}
#header-global bx-btn svg {
fill: var(--cds-icon-03);
}
Notice the use of unsafeHTML( UserAvatar20().strings.join('') )
. This is because the return type of the icon functions (UserAvatar()
in this example) is made with the old lit-html version svg
tag function, which is not compatible with the newer lit-html version. Hence the conversion to string first.
If you don't use lit 2, you can instead just use UserAvatar20()
.
Hi, how can I put some actions in the UI Shell header? I would like the icons at the right part of the header, as it is shown in the first live demo here: https://www.carbondesignsystem.com/components/UI-shell-header/usage/