theme-ui icon indicating copy to clipboard operation
theme-ui copied to clipboard

Make theme values passed to css and sx properties typesafe

Open ammar88 opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe. I'd like to find a way to make the value I pass to variant (and other theme aware properties) type safe and have it provide autocompleted values from my theme. Currently I can pass any string to variant and it will fail silently since variant accepts any string.

<SomeComponent sx={{ variant: 'accepts any string and produces no error' }} />

Describe the solution you'd like I'd like to able to pass a string that corresponds to what exists in my theme file and have errors produced if I pass a string that doesn't.

Additional Context Would this solve my issue?

ammar88 avatar Nov 09 '21 12:11 ammar88

Thanks for the issue. We are working on this in https://github.com/system-ui/theme-ui/pull/1090, but it’s been a big project. Help appreciated!!

lachlanjc avatar Nov 13 '21 20:11 lachlanjc