Skip to content

Avatar Issue #3627

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
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

moulichan99
Copy link

@moulichan99 moulichan99 commented Aug 6, 2025

Linked Issue

Closes #{https://github.com/skeletonlabs/skeleton/issues/3613#issuecomment-3151324428}

Description

Prevent more then 2 avatar initials by adjusting the getInitials function to output max 2 chars.
Reasoning:

The name prop is also used in the img's alt property.
So we want the alt to show the full name but want to prevent more then 2 letters in each avatar.

Checklist

Please read and apply all contribution requirements.

  • Your branch should be prefixed with: docs/, feature/, chore/, bugfix/
  • Contributions should target the main branch
  • Documentation should be updated to describe all relevant changes
  • Run pnpm check in the root of the monorepo
  • Run pnpm format in the root of the monorepo
  • Run pnpm lint in the root of the monorepo
  • Run pnpm test in the root of the monorepo
  • If you modify /package projects, please supply a Changeset

Changesets

View our documentation to learn more about Changesets. To create a Changeset:

  1. Navigate to the root of the monorepo in your terminal
  2. Run pnpm changeset and follow the prompts
  3. Commit and push the changeset before flagging your PR review for review.

Copy link

changeset-bot bot commented Aug 6, 2025

⚠️ No Changeset found

Latest commit: 04f3037

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Aug 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
themes.skeleton.dev 🔄 Building Preview Comment Aug 12, 2025 0:07am
www.skeleton.dev Failed Aug 12, 2025 0:07am

Copy link
Contributor

@endigo9740 endigo9740 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moulichan99 great job.

First off, make sure to complete the PR original post in full. It needs the original issue ID, a brief description, and the checkboxes ticked please. You will also need to include a Changeset as this modifies component code. Instructions are provided above.

Minus these small adjustments detailed below, the only other thing missing is documentation to show users how to implement and utilize this new feature. This will need to be present for both React and Svelte docs.

https://www.skeleton.dev/docs/components/avatar/react
https://www.skeleton.dev/docs/components/avatar/svelte

I'd recommend a new section above "Fallback" like so:

## Initials

Provide an `initials` array to define what part of the name is used to generate initials. Use index values to identify each desired name, and `-1` to represent the last possible name.

(example)

Per the example, feel free remove the initials showcase in the Fallback example and description. Then showcase 2-3 avatars with mixed usage in this new example block, including:

  • Default value (no prop defined) - moved from Fallback
  • All initials for a three word name, ex: [0, 1, 2]
  • Two initials from a three word name, [0, -1]

As per the name, something like "Jane Michelle Doe" will work.

@endigo9740
Copy link
Contributor

endigo9740 commented Aug 11, 2025

@moulichan99 just checking if you can address the feedback items above. If so an ETA would be welcome.

@moulichan99
Copy link
Author

@moulichan99 just checking if you have any intention on addressing the feedback items above. If so an ETA would be welcome.

addressing it today.

@moulichan99
Copy link
Author

@endigo9740 Pushed the review comment changes can you pls check ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants