Skip to content

feat(icons): add Icon suffix to all icons and deprecate old names #127

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

Merged
merged 4 commits into from
May 16, 2025

Conversation

rektdeckard
Copy link
Member

@rektdeckard rektdeckard commented May 16, 2025

After considering the request in #104 to add the "Icon" prefix to all icon components to aid readability in JSX and to not pollute the scope with common names, I have decided that doing something like this is worthwhile. After playing around with it I landed on using the suffix form, e.g.:

import { UserIcon } from "@phosphor-icons/react";

These are now the primary names for icon components exported from the library. The original names are still exported but are marked as deprecated, pointing users to the new suffixed name:

Screenshot 2025-05-16 at 12 07 00 AM

The filenames have not changed to reflect this, for two reasons:

  1. We are trying our best not to increase bundle size, and enev 4 characters adds up with over 4500 files to rename.
  2. We do not want to break any fully-qualified imports.

We also should now have better support in some edge cases for Next.js by way of better disambiguation between es and cjs exports.

I will publish this under the next tag on NPM for testing until confident in these changes.

@rektdeckard rektdeckard self-assigned this May 16, 2025
@rektdeckard
Copy link
Member Author

Seems to work fine in a few demos:

@rektdeckard rektdeckard merged commit 5ac3fd9 into master May 16, 2025
1 check passed
@rektdeckard rektdeckard deleted the tf/names-with-icon-suffix branch May 16, 2025 08:12
@slk333
Copy link

slk333 commented May 16, 2025

Thanks for working on this.

The request on #104 was for a prefix. Can you explain why you prefer a suffix?

Thanks!

@rektdeckard
Copy link
Member Author

Because one philosophy at Phosphor is to do things as simply as possible. If you'd call it a User icon in conversation, UserIcon makes the most sense. And because I liked it better.

I believe this strongly addresses 2 of the 3 issues OP has with naming, and more or less addresses the third. Sorry if you don't get the exact autocomplete behavior you were looking for 🤷‍♂️.

@jovana
Copy link

jovana commented May 17, 2025

I have upgraded to the latest version and noticed the deprecation message. I also came across this topic.
It seems the example website/documentation has not been updated yet.

Could you please share the timeline for when the old names will no longer be supported?

@rektdeckard
Copy link
Member Author

Answered in #104

@knownasilya
Copy link

With this change TextBolder is no longer available in the deprecated format, only as TextBolderIcon. Accidental breaking change?

@rektdeckard
Copy link
Member Author

@knownasilya that's a mistake, yes. I'll check for other legacy names and push an update. text-bolder itself has been deprecated in favor of text-b since 2.0, I assume that's the source of the issue.

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.

4 participants