Skip to content
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

Add size prop to icon packages #10

Open
mattrosno opened this issue Jun 14, 2021 · 1 comment
Open

Add size prop to icon packages #10

mattrosno opened this issue Jun 14, 2021 · 1 comment
Labels
carbon icons Library: icons implemented as Angular, React, Svelte, Vue and vanilla JavaScript components
Milestone

Comments

@mattrosno
Copy link
Member

Summary

We currently have ~1,250 icons in our icon packages. Since our system supports 4 sizes, this ends up with ~5,000 modules (1,250 icons * 4 sizes each). Add in a default entry point for each icon and its size, and that becomes ~6,250 files that get shipped in a package.

Historically, we've had to invest some time to fix infrastructure issues that have come from trying to satisfy packages that can grow to this size. In addition, it is easy for these packages to deopt and cause consumers to ship megabytes more code than they intend to when using this module.

Moving forward, we are moving from our "component per icon/size" strategy to a "icon with size prop" approach. While this could increase the size of individual icons that support multiple sizes, this would decrease the overall file size of each package and would allow better code re-use for icons that are downsized from 32x32 (which are the majority).

Job stories

  1. When rendering an icon as a Carbon Icons React component, I want to use a size prop that follows the system's size prop convention so I don't end up with failed imports from mis-using the hardcoded sizes in component names.

Success measures

  1. Deprecation notices are available for the <Add32 /> syntax
  2. size props are available on the icon components
  3. Codemod is available to assist teams to use the new icons API

Sponsoring team

Carbon team

@mattrosno mattrosno added this to the v11 release milestone Jun 14, 2021
@mattrosno
Copy link
Member Author

Epic: carbon-design-system/carbon#8139

@carbon-design-system carbon-design-system locked and limited conversation to collaborators Jun 14, 2021
@mattrosno mattrosno added the carbon icons Library: icons implemented as Angular, React, Svelte, Vue and vanilla JavaScript components label Jun 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
carbon icons Library: icons implemented as Angular, React, Svelte, Vue and vanilla JavaScript components
Projects
None yet
Development

No branches or pull requests

1 participant