Skip to content
Frontend
Skill

/chakra-ui-migrate

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

From plugin
chakra-ui
41k3 skills2 agents3 commands

Claude Code

$ npx -y skills add chakra-ui/chakra-ui --skill chakra-ui-migrate --agent claude-code

SKILL.md

chakra-ui-migrate.SKILL.md
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.

Chakra UI Migration: v2 → v3

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.

---

Step 1 — Inspect the project

Read these files to understand the current state:

package.json

Look for:

  • Current `@chakra-ui/react` version (v2.x vs v3.x)
  • Related packages: `@chakra-ui/icons`, `@chakra-ui/hooks`,

`@chakra-ui/next-js`, `@emotion/styled`, `framer-motion`

  • Framework: Next.js (App Router or Pages Router), Vite, plain React
  • Package manager (from lockfiles: `pnpm-lock.yaml`, `yarn.lock`, `bun.lock`,

`package-lock.json`)

Also spot-check key files when helpful:

  • Provider / theme setup (`_app.tsx`, `layout.tsx`, `theme.ts`)
  • Color mode usage (`ColorModeScript`, `useColorMode`, `useColorModeValue`)
  • Any component files showing heavy v2 patterns

---

Step 2 — Update packages

Remove v2-only dependencies

# 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.

Install v3 core packages

# npm
npm install @chakra-ui/react @emotion/react

# pnpm
pnpm add @chakra-ui/react @emotion/react

# yarn
yarn add @chakra-ui/react @emotion/react

Replacements for removed packages

| 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) |

---

Step 3 — Run the codemod

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.

---

Step 4 — Update the Provider

Old v2 pattern

// v2
import { ChakraProvider } from "@chakra-ui/react"
import theme from "./theme"

;<ChakraProvider theme={theme}>{children}</ChakraProvider>

New v3 pattern (using Chakra CLI snippets)

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.

Custom theme in v3

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}`.

---

Step 5 — Color mode migration

Remove all v2 color mode patterns

// 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} /> // ❌

v3 color mode approach

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.

---

Step 6 — Prop renames

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.

Boolean props

| v2 | v3 | | ----------------- | --------------- | | `isOpen` | `open` | | `defaultIsOpen` | `defaultOpen` |

Read more
@chakra-ui
Ships withchakra-ui

Chakra UI is a component system for building SaaS products with speed ⚡️

41k3 skills2 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
40.7k
Star history of chakra-ui/chakra-ui on GitHub, a chart by star-history.com

Other skills on chakra-ui.

chakra-ui-builder

chakra-ui-builder

Build responsive, accessible UI components and layouts using Chakra UI v3, install or configure Chakra UI in new and existing…

@chakra-ui@chakra-uiInstall Skill
chakra-ui-refactor

chakra-ui-refactor

Review, convert, and improve UI code using Chakra UI v3. Use this skill whenever a user wants to review Chakra UI code for…

@chakra-ui@chakra-uiInstall Skill

More skills from other plugins.

next-bundle-optimizer
Auto-invoked

next-bundle-optimizer

Audit and reduce Next.js browser initial-load work. Use for slow route startup, oversized client bundles, duplicate browser…

nextjs1d143k
@vercel@vercelInstall Skill
migrate-radix-to-base

migrate-radix-to-base

Migrates React projects and components from Radix UI to Base UI. Use when asked to migrate from radix, move to base-ui, convert…

ui10d127k
@shadcn-ui@shadcn-uiInstall Skill
chrome-release-cls

chrome-release-cls

Given a Chrome Releases blog post URL (chromereleases.googleblog.com), extract every CVE/bug and find the underlying Gerrit CL…

electron1d124k
@electron@electronInstall Skill
taste-skill
Auto-invoked

taste-skill

tasteskill v2, the anti-slop frontend skill. Art direction for websites, distilled from a study of 247 curated gallery sites (One…

@leonxlnx@leonxlnxInstall Skill

Questions about chakra-ui-migrate.

Which coding agents can use chakra-ui-migrate?
chakra-ui-migrate installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.