-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Token from theme object not assignable to util #1130
Comments
I'm not really sure what you want to do, but you don't need to import the import { styled} from '../../../styles/stitches.config'
const Component = styled('span', {
mv: "$space$xs"
}) You can read further in the docs here |
@Code-Victor I know about the other way, but I want/need to import tokens from |
Then I think the best this is the best solution. import { styled, theme } from '../../../styles/stitches.config'
const Component = styled('span', {
mv: theme.space.xs.computedValue, // returns "var(--space-xs)"
}) It generates the serialized CSS var() representing the token(so in this case, var(--space-xs)). |
Cool, thanks. It's actually a nice workaround. |
Also, if you're working with multiple themes or want the exact value. import { styled, config} from '../../../styles/stitches.config'
const Component = styled('span', {
mv: config.space.xs, // returns the exact value
}) |
Bug report
When trying to use utils in combination with tokens from
theme
I get a ts error.Describe the bug
Due to the lack of information on this topic in docs, along with inability to solve it with neither
PropertyValue
norScaleValue
and missing export of appropriate type, I assume this might be a bug.System information
The text was updated successfully, but these errors were encountered: