-
Notifications
You must be signed in to change notification settings - Fork 673
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
Document theme properties' default values #2026
Comments
This is on the list in #832! Relevant code here: https://github.com/system-ui/theme-ui/blob/develop/packages/css/src/index.ts#L76-L79 |
Ah ha, thank you @lachlanjc. I see “remove default |
Hmm, I'm of two minds there. I think it makes sense for fontSize & space since those are visible. But having some default breakpoints doesn't seem so bad? Setting them up is a bit of a pain & there are real scenarios where you don't need to customize those. But could definitely be convinced otherwise. |
You’re right. As long as it’s documented, having some default breakpoints makes sense! |
I've changed my mind on this. I'm actually in favor of keeping these default values — I think a big part of the appeal of Tailwind & how easy it is to get started with Tailwind is their excellent defaults. While most users will continue to want to set their own theme, anything we can do to make getting started faster seems like a win. & as you said, it's still easy enough to reset these values to be empty. Will plan to make this clearer in documentation. |
Cool, that works too! |
🚀 Issue was released in |
1 similar comment
🚀 Issue was released in |
Describe the bug
I noticed that if I omit some keys from the theme object I pass to the
ThemeProvider
, such asbreakpoints
andfontSizes
, some default values will be used, and I couldn’t find that documented anywhere so I don’t think it’s by design. The default values for these two keys are the same as in the base preset, but I can confirm that it’s not the whole base preset, asfonts
andfontWeights
behave as expected, for example. Could it have something to do with the fact thatbreakpoints
andfontSizes
are arrays? What’s especially strange is that I can’t find the default values in the theme returned by theuseTheme
hook; they only pop up when I try to use them (e.g.fontSize: 1
, or any value set to an array will flip at40em
, then52em
, etc.).To Reproduce
breakpoints
andfontSizes
keys from your theme.<div sx={{ fontSize: 1 }} />
font-size: 14px
.Expected behavior
I would’ve expected the rendered CSS to be
font-size: 1px
, which is the case when the theme has afontSizes
key set to an empty array.The text was updated successfully, but these errors were encountered: