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.

textStyles defined inside extendTheme aren’t applied correctly

See original GitHub issue

🐛 Bug report

Styles defined via textStyles are not applied correctly although they’re set within extendTheme.

💥 Steps to reproduce

  1. Go to my CodeSandbox
  2. Inspect Heading, Button, Text and the body element with the developer tools inside the browser
  3. Have a look at the styles set by Chakra UI and compare them

textStyles which should be applied

image

body styles

imagefont-size from textStyles is used. 💥 font-family and line-height aren’t applied by textStyles.

Heading styles

image 💥 Neither font-family nor font-size and line-height are applied by textStyles.

Button styles

imagefont-family from textStyles is used. 💥 font-size and line-height aren’t applied by textStyles.

Text styles

image ✅ All styles set by textStyles are used.

💻 Link to reproduction

CodeSandbox reproduction: https://codesandbox.io/s/textstyle-problems-ibu9h?file=/src/App.tsx:176-186

🧐 Expected behavior

Styles like font-family, font-size and line-height defined in textStyles should be applied when passed through extendTheme according to this comment. This behaviour should be consistent and reliable when used on all elements (even <body />).

🧭 Possible Solution

🌍 System information

Software Version(s)
Chakra UI 1.5.2
Browser Chrome, Firefox
Operating System macOS

📝 Additional information

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:8
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
bangngo1508commented, Jun 8, 2021

I am facing the same issue with the defaultProps

image

image

The defaultProps is not applied at all

3reactions
primos63commented, Oct 28, 2021

The issue was with the precedence order for which I believe I fixed and submitted a PR which has yet to be reviewed. I have no control over that. Workarounds should be temporary.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to style Chakra UI toast - with color - Stack Overflow
export const theme = extendTheme({ colors, components, textStyles }); ... First define styles for the custom variants in theme :
Read more >
Text and Layer Styles - Chakra UI
Properties defined in a layer style. Color or text color; Background color; Border width and border color; Box shadow; Opacity. // 1. Import...
Read more >
Styles and Themes - Android Developers
When you create a project with Android Studio, it applies a material design theme to your app by default, as defined in your...
Read more >
Diff - platform/frameworks/base - Google Git
Override + * {@link #sizeOf} to size the cache in different units. ... you can define two different layouts and apply the appropriate ......
Read more >
https://www.drupal.org/files/issues/0001-Initializ...
extend-theme -install-appearance-page.png | Bin 0 -> 49242 bytes ... mode by accessing it from another +browser where you aren't logged in.
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