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.

Text component doesn't inherit all typography styles

See original GitHub issue

I’ve recently migrated to version 4 but it doesn’t look like the Text component is inheriting all of the typography styles expected from the body property on fonts.

See CodeSandbox example.

I’ve double-checked the implementation with your documentation, but I can’t seem to see what could be wrong. Could you provide any additional direction?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
jxnblkcommented, Jan 2, 2020

By default the Text component doesn’t pick up particular styles from the theme. You can extend the component if you’d like to add default styles to the component

3reactions
brettinternetcommented, Oct 12, 2019

@marozzocom Thank you for your reply. This makes sense, I have no problem extending the component or adding global styles to correct the font.

The documentation’s example is confusing. The styled-system theming suggests being able to modify the body font-family and font weight: (Theming: Example)

  fonts: {
    body: 'system-ui, sans-serif',
    heading: 'inherit',
    monospace: 'Menlo, monospace',
  },
  fontWeights: {
    body: 400,
    heading: 700,
    bold: 700,
  },

What does the body attribute in styled-sytem themes actually modify then?

Also, calling the Text component a “Response typography component” seems inaccurate if it doesn’t inherit the typography attributes from the theme.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Styled component does not inherit styles when using "as ...
1 Answer 1 ; React from "react" ; import styled, {css} from "styled-components" ; import { typography, color } from "styled-system" ...
Read more >
Text style inheritance overview | Webflow University
Example 1 — Inheriting styles from the Body​​ By default, these elements inherit their text styling from the Body. You can see this...
Read more >
inherit - CSS: Cascading Style Sheets - MDN Web Docs
The inherit CSS keyword causes the element to take the computed value of the property from its parent element. It can be applied...
Read more >
1.1. Specifying Fonts and Inheritance - CSS Cookbook [Book]
You can enclose all font names in quotes, regardless of whether they contain spaces, ... A child element inherits, or has the same...
Read more >
Inherit, initial, unset, revert - QuirksBlog - QuirksMode
The fact that an element has margin-left: 10% does not mean all of ... Using it for font sizes or colours may occasionally...
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