question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Avatar Component (Revised)

See original GitHub issue

Technical Design: terra-avatar

Summary:

A discussion with UX has lead to a necessary redesign of the Avatar component. This revised tech design includes the following changes:

  • only two avatar types (User/Facility)
  • icon can no longer be provided as a prop (only the User and Facility icons are used)
  • specifying that if an image or text is provided, it will display in place of the fallback icon.

See the outdated tech design.

Expected behavior:

Should be able to give the component an image or text which will display inside a circular wrapper. If neither of these are provided, then the default User or Facility icons display. Which icon is displayed is determined by the prop ‘type’.

Responsiveness:

The content within the avatar does not change, only the size. The size of the avatar is dictated by the component where it lives.

I18N / Bi-directionality:

These changes should make no changes to the existing ltr/rtl functionality.

Interaction States

Avatars will not have interaction states. The hover state shown on the callouts will be controlled by the parent component not the Avatar.

Accessibility

We’ll provide an aria-label to indicate that the component is an avatar.

React Props:

Props Type Default Required? Description
alt string undefined No The text content that specifies the alternative text for the image.
variant string user No The type of avatar. Either 'user' or 'facility'.
image string undefined No The image to display.
initials string undefined No The initials to display. Limited to 2 or 3 characters.

Themeable Styles:

  • Background
    • color
    • opacity
  • Border
    • width
    • style
    • color
  • Box shadow
  • Font size
  • Font color
  • Size
  • Icon color
  • Line height

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:28 (22 by maintainers)

github_iconTop GitHub Comments

2reactions
dm123455commented, Feb 23, 2018

@ChaseSinclair I spoke with @neilpfeiffer and we do need to have the user variant as a default.

1reaction
neilpfeiffercommented, Feb 23, 2018

The full design has additional types/variants that are not being coded for initial implementation: patient and provider, which may have unique icons in the future, dictating the current proposal and would be passive approach to grow into.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Avatar component - Material UI
Avatars containing simple characters can be created by passing a string as children . H. N. OP.
Read more >
[docs] Revise the Joy UI "Avatar" component page #35152
Part of #33998. This PR revises the Joy UI "Avatar" component page. style and grammar changes throughout; added info on basic/default usage ...
Read more >
React Avatar Component
Avatar represents people using icons, labels and images. ... A set of Avatars can be displayed together using the AvatarGroup component.
Read more >
React Avatar Component
React avatar component can be used to display circular user profile pictures. Avatar can be used to portray people or objects. It supports...
Read more >
Material-UI Avatar Tutorial and Examples
In the following examples you will see how to use Material-UI's Avatar component, along with its close friend AvatarGroup.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found