Theme tokens not working #567
-
My stitches config: import { createCss } from "@stitches/react";
export const {
styled,
css,
global,
keyframes,
getCssString,
theme,
} = createCss({
theme: {
colors: {
primary600: "#49A47A",
},
},
media: {},
utils: {},
prefix: "",
insertionMethod: "append | prepend | () => {}",
themeMap: {},
}); My Button component (Not working until I replace import { styled } from "../../stitches.config";
const StyledButton = styled("button", {
backgroundColor: "$primary600",
}); Any help? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
A few things: The config you're passing in is a copy/paste from the docs which isn't really a recommended config. It's more to show the keys available. As a result of that you're passing in an empty "themeMap" object, so that's essentially removing all the mapping between properties and tokens. Also, the insertion method needs to be one of the documented options or left out completely. I'll improve the docs to make it clearer. Remove these keys and other keys you're not making use of and it should work fine. PS: for future reference please create issues instead of discussions for things like this. Thanks! |
Beta Was this translation helpful? Give feedback.
A few things:
The config you're passing in is a copy/paste from the docs which isn't really a recommended config. It's more to show the keys available.
As a result of that you're passing in an empty "themeMap" object, so that's essentially removing all the mapping between properties and tokens.
Also, the insertion method needs to be one of the documented options or left out completely.
I'll improve the docs to make it clearer.
Remove these keys and other keys you're not making use of and it should work fine.
PS: for future reference please create issues instead of discussions for things like this. Thanks!