Allow `space` theme values to be defined as an object.
See original GitHub issueThis may already be possible - so please let me know if it’s not actually an issue.
At the moment, we can define the most theme values as objects as opposed to arrays, such as fontSizes
:
const theme = {
fontSizes: {
body: 12,
largeHeading: 22
}
}
This is super useful for allowing changes to be made in the future without having to go and update every array index.
However, if you try to do this with space
, and pass it to a component margin or padding, it’s not recognised and no padding is applied. E.g.
const themes = {
space: {
small: 4,
large: 16
}
}
<Box px="small" mb="large">Example</Box>
Is there a reason for this? I’m getting lost in other packages, and sub-packages so can’t work out why this functionality is different from the other keys.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Theme Configuration - Tailwind CSS
The theme object contains keys for screens , colors , and spacing , as well as a key for each customizable core plugin....
Read more >xml:space Handling in XAML - Microsoft Learn
The xml:space attribute is an XML-defined attribute that declares the significant white-space processing behavior within an object element.
Read more >white-space - CSS: Cascading Style Sheets - MDN Web Docs
The white-space property is specified as a single keyword chosen from the list of values below. Values. normal. Sequences of white space are ......
Read more >Default Theme - Chakra UI
The theme object is where you define your application's color palette, type scale, font stacks, breakpoints, border radius values, and more.
Read more >Color modes - Theme UI
Styles within this object have access to other values in the theme object, such as colors, fonts, and space. To use these styles...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This would need to be address in styled-system. If you haven’t already, can you open an issue in that repo to discuss?
I can’t tell exactly either but I think it would be better if it the unit was always required, for example when configuring breakpoints I have to think about whether the unit is px, em, or rems…