ChakraUI/V3/Refactor Custom Theme

1.0.0Last update Oct 26, 2024
by@yugal41735
  • Replaces extendTheme with createSystem and defaultConfig.
  • Updates your theme object to fit the new structure required by Chakra UI.

Example

Before

import { extendTheme } from '@chakra-ui/react';
export const theme = extendTheme({
fonts: {
heading: `'Figtree', sans-serif`,
body: `'Figtree', sans-serif`,
},
});

After

import { createSystem, defaultConfig } from '@chakra-ui/react';
export const system = createSystem(defaultConfig, {
theme: {
tokens: {
fonts: {
heading: { value: `'Figtree', sans-serif` },
body: { value: `'Figtree', sans-serif` },
},
},
},
});

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now