Vertically Centering An Icon and Code Review #2978
-
Hi folks, Following is a screenshot of this figma design : https://www.figma.com/file/Bmr7ltHScX620smbk0DBpc/Signup-%2F-try-twilio-migration-to-Paste-(2022)?node-id=1415%3A242282&t=fpWvOvdNJHMUuTru-0 I am trying to create JSX for the right half of the page. In the right half, I am trying to vertically center the success icons in the card checklist so they align veridically across the text they represent. This is my JSX for it :
I played around by adding on top of the but it felt hacky. Is there a better way to do this alignment? Also, reducing the browser width and height doesn't resize the JSX components. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Hi @uditadhikari117, could you create a reproduction in CodeSandbox so our team can investigate this further? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi @uditadhikari117! I don't seem to have the same settings available in global protect, but I realize now that you provided your code in the first post, so I think that should be enough for us to discuss. Firstly, I see that you included a I spoke to our design team and they assured me that having the icons line up with the top line of text would also be fine for this design, although it would be better to leave the default spacing after the heading as opposed to zero-ing it out. If you'd still like to center the icon with the content, my suggestion is to take advantage of our Media Object component, which is specifically for an image or figure to be positioned horizontally next to some form of content. Hope this helps! |
Beta Was this translation helpful? Give feedback.
Hi @uditadhikari117! I don't seem to have the same settings available in global protect, but I realize now that you provided your code in the first post, so I think that should be enough for us to discuss.
Firstly, I see that you included a
className
in your component implementation. Paste components don't allow classes, since our design system has specific uses of properties and design tokens. If you were able to affect a component with a class, that is a bug and we'd like to know so we can fix it! Our component APIs are designed to be flexible enough for common use cases, and our primitives have the most style flexibility while still using our tokens. More information about why we do no…