question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make it possible to pass in margin to Thumbprint React components

See original GitHub issue

As @tomgenoni builds out revamped Thumbprint Utility classes and Jon K. revisits our spacing system, I think this would be a good opportunity to make it possible to add margins to our Thumbprint React components.

This has been a common pain point that folks have worked around by:

a. Adding a wrapper div. b. Avoiding the React components and using their Sass counterparts

Proposal:

<Button u="mb2 s:ms2">
  Click Me
</Button>

The prop u (for “utility”), added to all of our React components, will allow developers to pass in a whitelisted set of utility classes.

We’d start with margin classes, potentially expanding this to support other classes that affect the space around the component.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:22 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
tomgenonicommented, Jul 10, 2018

mt4 is Tachyons, the s: prefix is Tailwind and indicates breakpoints. https://tailwindcss.com/docs/what-is-tailwind/

1reaction
danoccommented, Jul 3, 2018

Re: @benknight’s example in his last comment, I’m leery about supporting the margin classname prop on every custom component, mainly for reasons cited in my first paragraph in this comment. Whatever solution we come up with should encourage less DOM elements to be used.

Not sure if I understand this part. How would a margin prop on Thumbprint components encourage more DOM?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add style - like margin - to react component?
I think I understand. 1) Applying CSS directly to React Components does not work--I can confirm that. 2) Passing props down to the...
Read more >
Using Atomic - Thumbprint Design System
Our spacing units go from 4px , 8px , 16px and so on and is used by the margin and padding classes. Note...
Read more >
How to style margin with React - DEV Community ‍ ‍
First of all, child component should not know the "layout style" of its parent component. For example, let's say there is a component...
Read more >
Passing shorthand margin as a prop throw an error on react ...
As a workaround you can call the prop m , ex: <Styled m="50 0" /> and it will work fine.
Read more >
Component Style - Chakra UI
This is a consistent theming API that makes component styling easy to understand and maintain. ... import { defineStyleConfig } from '@chakra-ui/react'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found