How to use theme object with typescript and @emotion/styled
See original GitHub issueAt the moment doing something like below throws an error Property colors does not exist in Object
import styled from '@emotion/styled'
const Div = styled.div`
background: ${({theme}) => theme.colors.brand}
`
I’ve tried many approaches and nothing works but I’ve seen in other issues the library supports Typescript. Is there anything I am missing or doing incorrectly?
Cheers and thank your such an amazing piece of work.
Issue Analytics
- State:
- Created 4 years ago
- Comments:19 (9 by maintainers)
Top Results From Across the Web
TypeScript
Emotion includes TypeScript definitions for @emotion/react and @emotion/styled . These definitions infer types for css properties with the object syntax, ...
Read more >EmotionJS with typescript doesn't pass theme type to props ...
Update regarding to unable override Theme via the custom type file. As I've seen the styled type only consume Theme object from @emotion/react ......
Read more >Styling a React TypeScript application with Emotion - Elliot Laws
In this post, I'll explain the process that was used to setup and add styles into the app using Emotion. I'll also cover...
Read more >TypeScript
Emotion includes TypeScript definitions for @emotion/react and @emotion/styled . These definitions also infer types for css properties with the object ...
Read more >How it Works
Emotion : used to generate isolated CSS with theming context · MDX: used to provide custom Emotion styled components to MDX documents, without...
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
What hinders you from creating the types from the theme?
Usage:
Hi, I want to add custom variants/styles and have a fully-typed theme. How can I use an extended chakra-ui theme with TypeScript? I can’t find a follow-up issue on this @segunadebayo.