carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.87k stars 1.82k forks source link

[Feature Request]: Add support for props.size to @carbon/pictograms-react #17687

Open janhassel opened 1 month ago

janhassel commented 1 month ago

The problem

The usage guidelines for pictograms specify five supported sizes: 48/64/80/96/128.

With Carbon v11, the icons (@carbon/react/icons) have received an API update allowing a size prop. The pictograms (@carbon/pictograms-react) however don't support this and the only way to scale them without CSS is to provide props.width and props.height which will be spread on the SVG element and overwrite the default 64px (undocumented).

Is there a reason for this or could we add an official size prop to have a consistent API between icons and pictograms?

The solution

Add a size prop to all pictograms in @carbon/pictograms-react. Since it's using the same base component as icons, this should be rather straight-forward to implement.

Examples

No response

Application/PAL

No response

Business priority

Low Priority = release date is not dependent on fix or not upcoming

Available extra resources

No response

Code of Conduct

github-actions[bot] commented 1 month ago

Thank you for submitting a feature request. Your proposal is open and will soon be triaged by the Carbon team.

If your proposal is accepted and the Carbon team has bandwidth they will take on the issue, or else request you or other volunteers from the community to work on this issue.

tay1orjones commented 1 month ago

Thanks for pointing this out! I'm not sure why this wasn't done with the icons size prop update in v11. Is there a design-based blocker of some kind @carbon-design-system/design?

Kritvi-bhatia17 commented 1 month ago

Good point @janhassel!

@tay1orjones we could introduce a size prop for pictograms that follows the sizes specified in IDL. This would probably encourage users to adhere to those specific sizes, and as mentioned the size prop could help enforce consistency across implementations.