Skip to content

Support alternative characters in Avatar #1055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nielslyngsoe opened this issue Mar 27, 2025 · 1 comment
Open

Support alternative characters in Avatar #1055

nielslyngsoe opened this issue Mar 27, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@nielslyngsoe
Copy link
Member

nielslyngsoe commented Mar 27, 2025

Which exact UI Library version are you using? For example: 1.0.1 - don't just write v1.

all of them

Bug summary

Regarding the uui-avatar component. It generates initials based on the given name. But:

The initials are generated based on a Regex that does not accept non-Enlighs characters.

Try names like "Åse Hylle" should become ÅH not SH
Or " Šummu Test" should be come ŠT not UT
Or " UlŠa Mya" should be come UM not UAM

Maybe a Regex like (?:^|\s)(.) could solve this.

See:
umbraco/Umbraco.Cloud.Issues#910

Specifics

No response

Steps to reproduce

Try set one of the mentioned names into the Avartar component

Expected result / actual result

No response

@nielslyngsoe nielslyngsoe added bug Something isn't working needs triage This issue has not been tested by a team member yet labels Mar 27, 2025
@bjarnef
Copy link
Contributor

bjarnef commented Mar 31, 2025

It may be worth considering optional initials property (e.g. 1-3 characters). A single character may be useful in a compact/small view or e.g. when grouped.

For members integrating with external provider perhaps initials are already in system. Perhaps name is in format firstname + lastname, but sometime people/employees/members in an organization have same letter in firstname and same letter in lastname. I think it may be common in a larger organization, where 2-letter initials + @company.com is not unique and some use 3-letter initials.

A few examples using initials property:
https://shoelace.style/components/avatar/#initials
https://vaadin.com/docs/latest/components/avatar#name-and-abbreviation (example with 3-letter initials)

In Fluent UI (by Microsoft) they have this to supply optional custom initials:
https://react.fluentui.dev/?path=/docs/components-avatar--docs

Image

@iOvergaard iOvergaard removed the needs triage This issue has not been tested by a team member yet label Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants