Allow consumer to edit stitches.config within of UI Component Library #941
bestickley
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
I stumbled upon something similar a while back. The custom theme api worked for me. So with your example that would be: import { createTheme } from "lib/stitches.config"
// The key primary12 needs to exist in the original theme for proper typing. I have not found a way to add keys.
const localTheme = createTheme({
primary12: "$purple12"
})
export const App = () => <Box className={localTheme} /> The result is very similar to yours, but you get full typing for all tokens inside of |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've created a UI component library with stitches and want consumers of the package to be able to edit the theme. This means I need the consumer of the package to be able to update what's passed to
createStitches
. Here is how I did it:lib/theme.ts
lib/stitches.config.ts
consumer/customizeTheme.js
consumer/main.tsx
consumer/App.tsx
Can you think of a better approach? Let me know!
Beta Was this translation helpful? Give feedback.
All reactions