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.

Allow `space` theme values to be defined as an object.

See original GitHub issue

This 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:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jxnblkcommented, Sep 8, 2018

This would need to be address in styled-system. If you haven’t already, can you open an issue in that repo to discuss?

1reaction
thomasbruscommented, Aug 21, 2018

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…

Read more comments on GitHub >

github_iconTop 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 >

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