Experimental. The API may still change in a future release.
Usage
User identifies a person with an Avatar, their name and an optional secondary line such as a role, an email address or a workspace. Use it in places that show who is signed in or who did something, such as the footer of a sidebar navigation or a user menu.
import { MtUser } from "@shopware-ag/meteor-component-library";
Examples
Avatar only
avatar-only hides the name and the subtitle visually, for example in a collapsed sidebar. The suffix slot stays visible.
With an action
The suffix slot holds trailing content, such as a menu trigger.
API reference
Props
| Prop | Type | Default |
|---|---|---|
name *The display name. The avatar shows the initials of its first and last word. | string | |
subtitleA secondary line below the name, such as a role, an email address or a workspace. | string | undefined |
image-urlAn image for the avatar instead of the initials. | string | undefined |
avatar-onlyHides the name and the subtitle visually, for example in a collapsed sidebar. They stay
available to assistive technology, and the `suffix` slot stays visible. | false | true | false |
Slots
| Slot | Bindings |
|---|---|
suffixTrailing content, such as a menu trigger or an action. | any |
Best practices
Do
- Keep the subtitle to one short piece of information, such as a role or an email address.
- Give an icon-only action in the
suffixslot an accessible name.
Don't
- Do not put several interactive elements inside User; add one action in the
suffixslot.
Behavior
- The avatar shows the initials of the first and last word of
name, orimage-urlwhen it is set. - Long names and subtitles are cut off with an ellipsis on one line.
Accessibility
- The avatar is hidden from assistive technology, because the name is shown as text next to it.
- With
avatar-only, the name and the subtitle are hidden visually but stay available to assistive technology.
Related components
- Avatar: when only a profile image or initials are needed, without a name.