-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat(tag): introducing custom icon #7262
feat(tag): introducing custom icon #7262
Conversation
✔️ Deploy preview for carbon-elements ready! 🔨 Explore the source changes: 77a582d 🔍 Inspect the deploy logs: https://app.netlify.com/sites/carbon-elements/deploys/60078ef9ad126d00078bf949 😎 Browse the preview: https://deploy-preview-7262--carbon-elements.netlify.app |
✔️ Deploy preview for carbon-components-react ready! 🔨 Explore the source changes: 77a582d 🔍 Inspect the deploy logs: https://app.netlify.com/sites/carbon-components-react/deploys/60078ef94a18630008ac552a 😎 Browse the preview: https://deploy-preview-7262--carbon-components-react.netlify.app |
Hey @IgnacioBecerra thanks for the contribution! I was just looking at Shixie's spec I think I would tweak the spacing a bit She's actually modified our tag for digital (.com team) and is using:
If you wanted a spec to add an icon to the Carbon tag, for product teams (which it looks like you're doing), here it is:
|
@jeanservaas Thank you for the specs! I modified the text color values to type 80 in @tw15egan Thank you for the examples! Using the @mjabbink Thanks for letting me know about that! I wasn't able to replicate the cropping, but I removed the css property that I suspect was the cause of the issue. |
@IgnacioBecerra Awesome! If you do want to allow a user to see that they can change the icon to whatever they want, you can add in a knob, like how we do for the button story. Here's the link if you're interested |
@tw15egan Thanks! Added three examples in the Storybook using the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for taking the time to work on this! 👍 ✅ 🚀
@emyarod Thanks. for the suggestions! I refactored using if/else if for better readability, let me know if you have any thoughts about it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like you are not using an autoformatter in your editor, can you try running yarn format
in the repository root?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this!
Related: carbon-design-system/carbon-for-ibm-dotcom#3669
This is a contribution for the
Tag
component in which allows the adopter to include any icon from@carbon/icons
before the content text. This feature had been requested as part of the Expressive theme in Carbon for IBM.com.The new
renderIcon
prop requires an icon component as an argument, which will render it accordingly within theTag
component.hasCustomIcon
must also be passed into theTag
component to activate the custom icon functionality.Here are some examples:
Using
renderIcon: Tag16
Using
renderIcon: Compass16
Changelog
New
renderIcon
prop to allow for a custom icon to be added before the content textTesting / Reviewing
Enable/disable the new prop, experiment with various icon names to ensure they render properly.