chakra-ui-builder
Build responsive, accessible UI components and layouts using Chakra UI v3, install or configure Chakra UI in new and existing projects, and design scalable…
Migrate Chakra UI projects from v2 to v3, covering package changes, codemods, provider setup, color mode, prop renaming, compound components, theming, recipes, and Next.js updates. Use this skill whenever a user is upgrading Chakra UI versions, encountering breaking changes
$ npx -y skills add chakra-ui/chakra-ui --skill chakra-ui-migrate --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/chakra-ui-migrateContext preview
The summary Claude sees to decide when to auto-load this skill.
Migrate Chakra UI projects from v2 to v3, covering package changes, codemods, provider setup, color mode, prop renaming, compound components, theming, recipes, and Next.js updates. Use this skill whenever a user is upgrading Chakra UI versions, encountering breaking changes
name: chakra-ui-migrate description: > Migrate Chakra UI projects from v2 to v3, covering package changes, codemods, provider setup, color mode, prop renaming, compound components, theming, recipes, and Next.js updates. Use this skill whenever a user is upgrading Chakra UI versions, encountering breaking changes after an upgrade, converting old v2 patterns (ColorModeScript, useColorModeValue, styleConfig, extendTheme, isDisabled, colorScheme, @chakra-ui/icons, framer-motion dependency), fixing compound component patterns, or asking about differences between Chakra UI v2 and v3 — even if they don't say "migrate" or "upgrade" explicitly.
You are guiding a developer through migrating their project from Chakra UI v2 to v3. Work through the steps below in order. Inspect the project first — never guess the package versions or framework.
> **Node requirement:** Chakra UI v3 requires Node >= 20.x. Confirm before > proceeding if the environment is uncertain.
---
Read these files to understand the current state:
package.json
Look for:
`@chakra-ui/next-js`, `@emotion/styled`, `framer-motion`
`package-lock.json`)
Also spot-check key files when helpful:
---
# npm npm uninstall @chakra-ui/icons @chakra-ui/hooks @chakra-ui/next-js @emotion/styled framer-motion # pnpm pnpm remove @chakra-ui/icons @chakra-ui/hooks @chakra-ui/next-js @emotion/styled framer-motion # yarn yarn remove @chakra-ui/icons @chakra-ui/hooks @chakra-ui/next-js @emotion/styled framer-motion
`@emotion/styled` and `framer-motion` are no longer required in v3.
# npm npm install @chakra-ui/react @emotion/react # pnpm pnpm add @chakra-ui/react @emotion/react # yarn yarn add @chakra-ui/react @emotion/react
| Removed | Replacement | | -------------------- | -------------------------------------------- | | `@chakra-ui/icons` | `lucide-react` or `react-icons` | | `@chakra-ui/hooks` | `react-use` or `usehooks-ts` | | `@chakra-ui/next-js` | `asChild` prop pattern (see Next.js section) |
---
The official codemod handles most mechanical changes: component renames, prop updates, import rewrites, and compound component restructuring. It does not replace manual review — plan to audit the output.
**Dry run first (no files changed):**
npx @chakra-ui/codemod upgrade --dry
Review what it proposes. When satisfied:
npx @chakra-ui/codemod upgrade
After the codemod, commit the changes before making manual edits so you have a clean diff to work from.
---
// v2
import { ChakraProvider } from "@chakra-ui/react"
import theme from "./theme"
;<ChakraProvider theme={theme}>{children}</ChakraProvider>Generate the provider and component snippets:
npx @chakra-ui/cli snippet add
This creates `components/ui/provider.tsx` (plus `toaster` and `tooltip` snippets) and automatically installs required npm dependencies — including `next-themes`. Import and use it:
// v3 — app/layout.tsx (Next.js App Router)
import { Provider } from "@/components/ui/provider"
;<html lang="en" suppressHydrationWarning>
<body>
<Provider>{children}</Provider>
</body>
</html>The `Provider` file includes `"use client"` — do not add it to `layout.tsx`. See the Next.js section for Pages Router placement.
Replace `extendTheme` with `createSystem`:
// v2
import { extendTheme } from "@chakra-ui/react"
// v3
import { createSystem, defaultConfig, defineConfig } from "@chakra-ui/react"
export const theme = extendTheme({ colors: { brand: { 500: "#2196f3" } } })
const config = defineConfig({
theme: { tokens: { colors: { brand: { 500: { value: "#2196f3" } } } } },
})
export const system = createSystem(defaultConfig, config)Pass `system` to `ChakraProvider` via `value={system}`.
---
// REMOVE these v2 imports and usages:
import { ColorModeScript } from "@chakra-ui/react"
// ❌
import { useColorMode } from "@chakra-ui/react"
// ❌ (use next-themes)
import { useColorModeValue } from "@chakra-ui/react"
// ❌ (use CSS tokens)
import { DarkMode, LightMode } from "@chakra-ui/react"
// ❌
// Also remove from _document.tsx:
;<ColorModeScript initialColorMode={theme.config.initialColorMode} /> // ❌Color mode is handled by `next-themes` via the generated `Provider`. Use semantic tokens that automatically respond to the active color mode:
// Use Chakra semantic tokens — they flip automatically in dark mode <Box color="fg.default" bg="bg.subtle"> ... </Box>
For a color mode toggle, use the generated `components/ui/color-mode.tsx` snippet or `useColorMode` from `next-themes` directly.
---
These boolean and style props were renamed in v3 for consistency with HTML and modern React conventions. The codemod catches most of these, but verify manually afterward.
| v2 | v3 | | ----------------- | --------------- | | `isOpen` | `open` | | `defaultIsOpen` | `defaultOpen` |
Chakra UI is a component system for building SaaS products with speed ⚡️
Repo: chakra-ui/chakra-ui
Build responsive, accessible UI components and layouts using Chakra UI v3, install or configure Chakra UI in new and existing projects, and design scalable…
Review, convert, and improve UI code using Chakra UI v3. Use this skill whenever a user wants to review Chakra UI code for issues, convert plain HTML/CSS,…