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.

Remove sx props from Paragraph component

See original GitHub issue

https://github.com/system-ui/theme-ui/blob/29b9b37f37b22924c5afe516972acc0c02266d71/packages/components/src/Paragraph.js#L14-L22

While I appreciate the intent, this makes it really tough to use Paragraph except for one very specific use case. It takes a specificity hack to defeat it using the theme:

export const theme = {
  text: {
    paragraph: {
      ':not(_)': {
        my: 3,
        maxWidth: 'unset'
      }
    }
  }
}

I think the margin reset probably belongs in a base theme, and the maxWidth is an interesting idea that could be mentioned in the documentation or included in a paragraph variant in one of the themes.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
hasparuscommented, Feb 22, 2021

@flo-sch No idea TBH, mate. I remember jxnblk’s comment he wanted to move towards sx everywhere, but I’m not sure if I can find it.

My opinion on this is:

  • You want shorthand style props? Build your own components on top of Theme UI Components (which most likely is sth you’d do anyway when your UI gets complex). Or use Chakra for a ready-made set of UI primitives.
  • Want a high-level layer on top of your className prop similar to style prop but allowing all legal CSS (Emotion) or even fancier shenanigans (That’s Theme UI).
2reactions
hasparuscommented, Feb 14, 2021

Hi @aaronadamsCA 👋 Thanks for the issue!

cc @lachlanjc @flo-sch

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Remove sx props from Paragraph component -
Remove sx props from Paragraph component. ... I appreciate the intent, this makes it really tough to use Paragraph except for one very...
Read more >
The `sx` Prop - Theme UI
The sx prop lets you add any valid CSS to an element, while using values from your theme to keep styles consistent. You...
Read more >
MUI: how to style a <p> using sx prop? - Stack Overflow
So how am I supposed to style a paragraph? Is targeting using classes the only option here? reactjs · material-ui.
Read more >
Display - MUI System
Quickly and responsively toggle the display value of components and more with the display utilities. Includes support for some of the more common...
Read more >
sx prop - Mantine
All Mantine components support sx prop. With sx you can add styles to component root element. If you need to customize styles of...
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