-
Notifications
You must be signed in to change notification settings - Fork 672
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
Add sx prop to Themed components #1350
Comments
Hi @hoobdeebla - thanks for submitting this issue. I don't think the sx prop worked without the jsx pragma before. Here is a codesanbox with theme-ui 0.3.4 and using a component with the jsx pragma and one without https://codesandbox.io/s/nameless-sun-hspem-forked-h2q3c However, if you can re-create the issue I will be glad to take a look. @hasparus any feedback about the |
Hmm. I feel like sx should work on Themed just like it does on our components, without the pragma |
@lachlanjc - it used to be that sx would work on some components that are just passing it down to ie For Styled/Themed, I dont think it ever worked since they are not using Box. In my opinion, all theme-ui components should work without a pragma by default. Maybe we can document using the babel config/preset as the first-choice option for using theme-ui and mostly get away from the pragma. |
It should be okay now. That was just a type issue. We had @atanasster is right, Themed.X never supported And this is how it looked 10 months ago
|
My mistake, I was testing going back and forth between classic/pragma and automatic/ IMO the As an aside, it would be cool if |
Hi! We're big fans and users of Similar to @hoobdeebla , our alternative now is to drop down to something like |
@freeman-lab Yeah, I discovered your awesome repos the other day & added the links to our Resources docs! Love what you're working on there—I'm also using Theme UI for some climate-related work :) |
@hoobdeebla yes very valid points for a new feature request. I was just mentioning that it did not exist in previous versions. |
It doesn't cost us much to support
However, I'm surprised seeing you all writing |
Is this working now? I thought it wasn't at first, and started searching for a fix. But I'd confused myself with some duplicated code, and the |
Hey @fwextensions, I just doublechecked the code, and we do use Theme UI's |
I'm using JS. |
As of v0.6, the
Styled
component was renamed toThemed
. After renaming all imports and updating theme-ui, thesx
styles on myThemed
components are no longer applied unless I explicitly state@jsxImportSource theme-ui
(auto runtime) or@jsx jsx
(classic). Thesx
object is also no longer recognized by VS Code as an instance ofThemeUIStyleObject
forThemed
, whereas it is properly reflected forBox
,Image
, etc.This seems to be a regression made somewhere between 0.5 and 0.6, as all my
Styled
components worked as intended up until the 0.6 release. Tested and confirmed on all 0.6 versions.Example code:
Expected:

Actual:

The text was updated successfully, but these errors were encountered: