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.

Feature request: use `!important` with theme value

See original GitHub issue

I’d like to be able to do something like following:

<div sx={{ ml: important(4) }}>

that is, using theme value (eg. from space scale), but with !important appended to it in resulting CSS.

Is there currently any way to achieve this? I thought only of this:

const Component = () => {
  const { theme } = useThemeUI()
  return (
    <div sx={{ ml: `${theme.space[4]}px !imporant` }}
  )
}

Any ideas?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
hasparuscommented, Dec 17, 2020

BTW I believe first-class support for the !important flag would be still useful.

I think that CSS-in-JS solves the problem of specificity, and you can achieve everything you need without !important. I’d discourage using important, and I doubt we’ll introduce any “first-class support” for it.

5reactions
jxnblkcommented, Sep 23, 2019

There aren’t any helpers like what you’ve described currently, but you can also use functional values like so: ml: t => `${t.space[4]}px !important` – with that in mind, I think you might be able to create a utility that does this in a more ergonomic way

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prioritising the right feature set using theme based ...
To identify themes, use the following: Look at the product backlog and see if if there are certain trends which can be used...
Read more >
Feature request: general background theme, more options?
The 'theme' itself is a lot more than just the background: when ... You can edit the colors and pick something else using...
Read more >
Feature Requests: How to Collect Them and Engage Users ...
Feature requests are an important window into your customers desires and priorities. Here's how to make the most of them, and handle the ......
Read more >
How To Prioritize Feature Requests: 5 Tips for Success
Here's some ideas on how to prioritize feature requests for your SaaS ... your SaaS product features according to the value they bring....
Read more >
[Case Study] Building a Better "Feature Request" System ...
By now, you'll have spotted that it's important to respond to all feature requests in a positive way. This doesn't mean that you...
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