theme-ui
theme-ui copied to clipboard
components: Remove style props
We'd mentioned this in #2275 & #832 as part of simplifying our API, as it can lead to confusing CSS ordering & overrides: if I have the same property in a style prop & sx, which wins out? It's especially unclear from a component that's wrapping a Theme UI component. This is a big, breaking change, so it should definitely not be in our MDX release, in case folks don't want to upgrade immediately. Providing a codemod would be great too; I haven't worked on that yet.
Release notes
-
BREAKING: Theme UI Components no longer accept style props (e.g.
<Box bg="primary" mt={3}
), in favor of only supporting styling through thesx
prop.- The
Field
component now accepts a secondcontainerSx
prop, intended to replace whitespace style props (e.g. to convert<Field my={3} sx={{ … }}
to<Field containerSx={{ my: 3 }} sx={{ … }}
).Checkbox
,Select
, andSwitch
have this new prop as well.
- The
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
theme-ui | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Nov 28, 2023 3:50pm |
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit 37becf737381e485dcd5b72017f785b1616babb6:
Sandbox | Source |
---|---|
next-theme-ui-example | Configuration |
gatsby-plugin-theme-ui-example | Configuration |
@hasparus thoughts on this?
Looks good to me. I very much appreciate the containerSx prop!
@lachlanjc I can write a simple codemod if you think it's good to merge.
That'd be amazing! Definitely my main hesitation.