Create new Avatar component with OCS styling.
terra-avatarThis is a new component that allows the consumer to specify which type of avatar they wish to utilyze for their use case.
Should be able to give the component an icon, an image or text which will display inside the circular wrapper.
The content within the avatar does not change, only the size. The size of the avatar is dictated by the component where it lives.
These changes should make no changes to the existing ltr/rtl functionality.
Avatars will not have interaction states.
We'll provide an aria-label to indicate that the component is an avatar.
| Props | Type | Default | Description |
| ----------- | ----- | --------- | --------------------------------------------------------- |
| alt | string | undefined | The text content that specifies the alternative text for the image. |
| icon | element | undefined | The icon to render. |
| image | string | undefined | The image to display. |
| initials | string | undefined | The initials to display. |
Should be able to give the component a child (icons, image or text) which will display inside the circular wrapper.
Can we change this _child_ to be _graphic_?
Can we add an aria-label for the entire component that would just read avatar or something simliiar to this design, under an accesibliity section?
You mention in the props table above that icons is
array of elements
This is probably an implementation detail, but I, personally, wouldn't mandate that it's an array. Rather, I'd set the prop to be able to accept an element, or an array of elements.
If you're familiar with the way that React handles opaque data types like children, they essentially give the ability to pass one, or a number of children to a given component. I have an example of this I can show you.
Can we mention the props that are defined vs those optional?
By 'defined', do you mean have default values? All props are optional, and variant defaults to 'default'. If none of the props are provided then an empty circular avatar is rendered.
Can we mention the variant types for the avatar?
Yep, that's mentioned in the table.

By "Should be able to give the component a child", did you mean it should have children as a prop?
This should probably be rephrased to "Should be able to give the component a list of icons, an image or text which will display inside the circular wrapper.".
Circle stroke width needs to be theamable.
It is themeable as border width.
Update the design with the interaction states?
Avatars will not have interaction states as mentioned in the callouts. I've updated the tech design to mention this.
Can we explicitly mention the icon properties that would be themeable?
I mentioned that the icon color is themable. The size of the icons is inherited from the avatar size itself.

The multiple variant has been removed as a part of this issue. It is not required for consumer work in this quarter. @bjankord @dm123455
+1
+1
Is this expected to be an enhancement of the ProfileImage or will this be a standalone component?
Is this expected to be an enhancement of the ProfileImage or will this be a standalone component?
It is a standalone component.
Does this depreciate profile image?
Does this depreciate profile image?
This may be a question @bjankord could answer. I would think we could deprecate profile image with this.
I would think we could deprecate profile image with this.
They do sound like very similar concepts IMO. Could we just enhance the Profile Image?
They do sound like very similar concepts IMO. Could we just enhance the Profile Image?
I remember speaking with @bjankord about whether to start a new component or enhance the existing. We came to the conclusion that the avatar was different enough to warrant a new component.
Could you explain in more depth when the Avatar would be used over the ProfileImage? They sound like very similar concepts IMO.
They do share some similarities, but the Avatar can display text or a custom, theme-able icon.
+1 on tech design. On this, I'd like to move forward with avatar as a new component separate from profile-image. Then, at a later date, follow up on reconciling the 2 components into 1 component. I foresee us deprecating profile-image and addinf it's functionality into the OCS avatar component.
JIRA created
Most helpful comment
You mention in the props table above that
iconsisThis is probably an implementation detail, but I, personally, wouldn't mandate that it's an
array. Rather, I'd set the prop to be able to accept an element, or an array of elements.If you're familiar with the way that React handles opaque data types like
children, they essentially give the ability to pass one, or a number of children to a given component. I have an example of this I can show you.