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.

Adding textStyles to the component theme

See original GitHub issue

🚀 Feature request

Please describe your request in one or two sentences.

I want to be able to define a custom theme component and give it one of my textStyles.

🧱 Problem Statement / Justification

Please provide valid reason(s) why this should added to Chakra UI.

I think this is something that should be used because we want to have an easier typography.

If this feaure is related to a problem you’ve noticed. Mention it as well

✅ Proposed solution or API

Please provide code snippets, gists, or links to the ideal design or API

This is an example of setting up the theme for a Table component.

const textStyles = {
  body4: {
    fontSize: '1.4rem',
    fontWeight: 'bold'
    lineHeight: '1.4rem',
  },
}

const sizes = {
  sm: {
    th: {
      px: '8',
      py: '4',
      textStyle: 'body4',
    },
  }
}

or

const baseStyle = {
 th: {
  textStyle: 'body4',
 }
}

↩️ Alternatives

What alternative solutions have you considered before making this request?

📝 Additional Information

What resources (links, screenshots, etc.) do you have to assist this effort?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
yotam707commented, Jan 31, 2021

Actually, it was solved by using the apply property but wanted a better API for this:

const baseStyle = {
  table: {
    tr: {
      borderBottom: '1px',
      borderColor: 'grey.500',
      th: {
        apply: 'textStyles.body4',
      },
    },
  },
}

And I think a better API for this would be:

const baseStyle = {
  table: {
    tr: {
      borderBottom: '1px',
      borderColor: 'grey.500',
      th: {
        textStyle: 'body4',
      },
    },
  },
}
0reactions
CloudLookscommented, Feb 7, 2022

@TimKolberger Could you point me to apply in the documentation? This is very useful but I do not see it documented. Maybe it has been replaced?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use themes to share colors and font styles | Flutter
To share colors and font styles throughout an app, use themes. You can either define app-wide themes, or use Theme widgets that define...
Read more >
Text and Layer Styles - Chakra UI
Style props are a way to alter the style of a component by simply passing props ... You can put these styles in...
Read more >
Building a Material Theme on Android: Typography
Material Theming is a way to customize Material Components to align with your brand. A Material theme includes color, typography and shape ...
Read more >
Material Design 2 in Compose - Jetpack - Android Developers
The Material Design components (buttons, cards, switches, and so on) are built on top ... A Material Theme contains color, typography and shape...
Read more >
Theming with Styled Components - DEV Community 👩‍💻👨‍💻
Let's add a theme.js to hold this object, since it will grow over time. const theme = { fontSource: 'https://fonts.googleapis.
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