Migrating a custom project
Your app has its own components, years of CSS or an old UI kit. You do not need to know how to move it: a coding agent replaces the whole interface with Koala, deletes everything old, and keeps what your product does.
What you end up with#
- Every screen drawn with Koala, in your brand.
- No old stylesheets, overrides, duplicate components or unused packages left in the repo.
- A clearer structure: one shell, navigation grouped by what people do, and screens that follow the same layouts.
- The same features, data and business rules as before.
- A written report of what changed and proof that each part still works.
With a coding agent#
The Koala skill carries this page, so an agent can run the whole migration. Install the skill in your project, then start a new session.
npx koalaui-cli@latest skillThen ask for the audit first:
Migrate this whole project to Koala UI and leave nothing of the old UI behind.
Follow references/migrate.md in the koala-ui skill.
Explain everything in plain language: I am not an expert.
Start with the audit and write the plan to koala-migration.md.
Change nothing until I approve it.The agent makes the technical decisions and proposes a better structure for your product. It only stops for yours: approving the plan and that structure, choosing on Pro items, and accepting the result. The plan lives in your repo, so a later session picks up where the last one stopped. Cursor, Codex and other agents need one line pointing at the skill, see AI and agents.
If you are the agent#
- Lead. Assume the owner cannot judge technical options. Decide them, and put only product and money decisions to the owner, in plain words, one at a time.
- Finish. The job is done when Step 7 passes, not when the new screens look right.
- Improve the structure. A structure that grew by accident is part of the problem. Propose a better one with reasons, then build what the owner approves.
- Delete only code. Old interface code goes. Never delete data, uploads, database migrations, environment files, or backend and business logic.
- Stay on the branch. Work and commit on
koala-migration. Merging and deploying belong to the owner. - Report the truth. If a check fails or something cannot be moved, say so in the plan and to the owner. Never skip or weaken a test to continue.
Before you start#
| You need | If you do not have it |
|---|---|
| React 19 | Upgrade React first, as its own change. |
| Tailwind CSS v4 | Upgrade from v3 first. On a project without Tailwind, add it, then read Keeping both working below. |
The @/* path alias | Add it to tsconfig.json, and to vite.config.ts in Vite. init checks it. |
| Next.js or Vite | init detects both. Anywhere else it prints the steps to wire by hand. |
| Git | Put the project in git first, even if it never was. Every deletion must be recoverable. |
A koala-migration branch | Commit or stash everything else first. The running product stays untouched until the owner merges. |
Old software#
An app from years ago rarely meets those requirements. Bring the foundations up first, one commit each, and confirm the app still runs before any screen changes.
| If it has | Do this first |
|---|---|
| React 15 to 18 | Upgrade one major version at a time, each as its own commit. React 19 removes ReactDOM.render, findDOMNode, string refs and legacy context. Class components still work. |
| Create React App, Gulp, Grunt, an old webpack | Move the build to Vite, and keep the routes and environment variables. |
| Plain JavaScript | Add TypeScript with allowJs. Old files keep working, and Koala's components arrive typed. |
| An old Node version | Move to the current LTS first. Old build tools often break here, so fix them in this step. |
| Tailwind v1 or v2 | Move to v3 first, then run npx @tailwindcss/upgrade to reach v4. |
| Tailwind v3 | Run npx @tailwindcss/upgrade to reach v4. |
| Bootstrap, jQuery UI, an old Material-UI | Replaced surface by surface, then removed with their stylesheets and themes. |
| jQuery in the pages | List what each script does, rebuild it as React state or a Koala component, then delete the script. |
| Sass, Less, global CSS | Replaced by tokens and Tailwind. Every stylesheet is deleted by the end. |
| AngularJS, Vue, Backbone, or pages rendered by PHP, Rails or similar | Koala is React, so this is a rebuild of the interface. A new Vite or Next.js app replaces it screen by screen, on the same backend. Say so clearly before planning, with what it means for time and cost. |
Protect what works#
Old projects often have no tests, so nothing would catch a break. Before the first change:
- Tag the start. Run
git tag koala-migration-start, so the original can always be recovered. - Capture every screen. Screenshot each route at desktop and phone width, signed in and signed out, into
koala-migration/before/. - List what people do. Write the main flows in
koala-migration.md, such as signing in, creating a record or taking a payment, and have the owner confirm the list. - Add smoke tests. Cover those flows with Playwright against the old interface, selecting by role and text so the same tests still pass on the new one.
Step 1: Audit#
Read the project before touching it, and record what you find:
- The stack. Framework, React and Tailwind versions, the styling method (CSS Modules, Sass, styled-components, Emotion, a kit such as MUI, Chakra, Ant or Bootstrap), and the checks the project has: tests, type checking, lint, build.
- The surfaces. Every reusable UI component, or every kit component in use, with how many files import it. Usage count sets the order.
- The structure. The kind of product, each screen’s regions and their order, how navigation works, what scrolls, what happens on small screens, and whether it runs on touch.
- The brand. The primary color, neutrals, radius, fonts and any dark mode, read from the existing tokens or the most repeated values.
- What is yours. Domain components that mean something only in this product, such as a shipment timeline or a seat map. They stay as features, rebuilt from Koala parts and tokens, and their old CSS goes.
- The leftovers. Every stylesheet,
!important, inline style, CDN script, vendored file inpublic/, duplicate component and class name built from strings. This list is what Step 7 has to bring to zero.
Step 2: Plan#
Write koala-migration.md at the project root and get it approved before any code changes. Each surface gets its Koala counterpart from the maps below, its tier from npx koalaui-cli@latest list, and a place in the order. Anything with no counterpart is rebuilt from Koala parts and tokens.
# Koala migration
Stack: Next.js 16, React 19, Tailwind 3, CSS Modules
Blockers: Tailwind 3 to 4
## Brand
Primary #0f766e, radius 12px, Inter
## Structure
Point of sale on a touch screen: density compact, controls size lg
Regions: top nav, open tickets, product grid, ticket panel
Problems: 8 top-level items, clock-in and messages mixed with sales, cart scrolls away
Proposal: Sell, Tickets, Customers, Inventory, Till; the rest under the profile menu
Shell: LayoutTopbar + Navbar (Pro, ask), three LayoutPane columns, Charge always in view
Decision: approved by the owner, on the sell screen the columns keep their order
## Surfaces, in order
- [ ] Button (41 uses): src/components/Btn.tsx > Button
- [ ] Text field (18 uses): src/components/Input.tsx > Input, Field
- [ ] Modal (6 uses): src/components/Modal.tsx > Dialog
- [ ] Data grid (3 uses): react-table > Data Table (Pro, ask)
## Domain features
src/components/CashCount.tsx: rebuilt from Koala parts
## Flows to protect
Sign in, open the till, sell, refund, close the till
## Leftovers to clear
12 stylesheets, 340 !important, jQuery from a CDN, Bootstrap 3Mark every Pro item and let the project’s owner choose: buy a license, compose the free components, or keep what exists. Never rebuild a Pro component from its docs or preview.
Old software grows by accident: menus nobody ordered, screens that each work differently. Replacing the pieces alone would give you the same confusion in a better paint, so the plan also proposes a new structure, for the owner to approve. For each screen it records what is there today, what is wrong with it and what replaces it:
- One shell. Pick one app structure from Step 6 and use it everywhere, instead of a different frame per screen.
- Navigation by task. Group items by what people do, not by how the code or the company is organized. Keep the top level to about seven items, and move settings and account actions under a profile menu.
- Repeated screens, one layout. Every list, detail, form and settings page follows the same layout, with one page header and one primary action.
- The main action in view. What people do all day stays on screen and within reach, on every size the product supports.
- The missing states. Plan empty, loading and error states, which old screens rarely have.
Show the proposal in plain language, with the worst screen as a before and after, and ask what people rely on. A tool used all day needs a lighter hand: habits are worth protecting, so move rarely used items out of the way and keep the positions people work from by memory. The owner can approve all of it, part of it, or keep the structure as it is.
Step 3: Set up the foundation#
init adds koala.css, lib/utils.ts, lib/tv.ts, the theme provider and koala.json, and leaves your components alone. Follow the steps it prints for the fonts and the provider, and resolve every warning it gives.
# Tokens, the lib helpers and the theme provider
npx koalaui-cli@latest init
# Only if the plan uses Pro components
npx koalaui-cli@latest login <your-key>
# The free components the plan needs
npx koalaui-cli@latest add button input field dialogIf you already have a lib/utils.ts, init keeps it. Merge Koala’s version in with npx koalaui-cli@latest diff utils: lib/tv.ts imports twMergeConfig from it. If you have a components/ui/button.tsx of your own, add skips that file and keeps yours, with only a warning. Move those files to components/legacy/ before the first add, update their imports, and commit that on its own.
Step 4: Bring your brand#
Set your brand once, on the tokens, before swapping any component. After that every Koala component arrives in your colors. Put this after the import of koala.css:
:root {
--brand: #0f766e;
--radius: 0.75rem;
}A light brand color also needs a dark --brand-foreground. Load your fonts as --font-sans and --font-heading. An app with one look pins it with <ThemeProvider forcedTheme="light">. For a palette of your own, see Theming.
Step 5: Swap one surface at a time#
- Start at the bottom. Buttons and text fields first, then overlays, then the pieces inside navigation. Each layer leans on the one before it, and the shell comes last.
- One surface, one commit. Add the component, read its reference, replace every use, and run the project’s checks and the smoke tests before moving on.
- Delete as you go. In the same commit, remove the old component, its styles and every override aimed at it. Search for its name and its CSS classes first, including strings built at runtime. Do not leave a wrapper around Koala that keeps the old name.
- Translate props, keep behavior. Handlers, validation, disabled conditions and analytics stay exactly as they were. Screens only move as the approved structure says.
- Rebuild the domain features. Compose them from Koala parts, and replace hard-coded colors and radii with the map below, so they follow the themes too.
- Tick it off. Update
koala-migration.md. When a step fails its checks, fix it or stop and say so: never skip a test to move on.
Step 6: Move the structure#
With the pieces in place, build the approved structure, one screen at a time. What the structure is follows from the parts you drop in. Layout and its Navbar and Sidebar are Pro. Without a license, build the free column with Tailwind between Koala components.
| In your project | With Layout (Pro) | With the free components |
|---|---|---|
| Top navigation over the content | LayoutTopbar with Navbar, then LayoutContent | A header with Link or Button, and Tabs for the sections. |
| Side navigation | LayoutSidebar with Sidebar, then LayoutContent | A flex row with a ScrollArea column of Buttons. |
| Top bar over a side rail | LayoutTopbar, LayoutBody, LayoutSidebar | The two above, nested. |
| Icon rail plus a second column | LayoutRail, LayoutSidebar | Two fixed columns, with Tooltip on the icons. |
| Columns side by side: inbox, list and detail, point of sale | LayoutPane and LayoutPaneHeader | A CSS grid with one ScrollArea per column. |
| Columns the user can resize | Resizable | Fixed widths. |
| Page title with actions | PageHeader, PageHeaderActions | A flex row with a heading and Buttons. |
| Sign-in or onboarding split | SplitLayout, SplitPane, SplitMedia | A two-column grid. |
| Phone navigation | LayoutMobileBar, LayoutMobileSidebar | Drawer behind a menu Button. |
- Lose nothing. Every feature stays reachable, with its permission checks and badge counts. When a URL changes, the old one redirects to the new one, so bookmarks keep working.
- Set the density once.
compactfor an app shell,comfortablefor a marketing page, with aDensityProvideraround the subtree. See Density. - Size for the hand. Density tunes spacing, not control height. On a touch screen, pass
size="lg"to the controls people hit all day. - Keep the language. Components say a few words on their own, such as Close or Next. In an app that is not in English, set them once with Translations, then check every screen for English left behind.
- Keep what scrolls. A column that scrolled alone still does, and the action that was always in view stays in view. Check it at the smallest screen the product supports.
Component map#
What most projects have, whatever it is called there. Every Koala name links to its page, and the skill holds the same page as a reference for each free component.
| In your project | Koala UI | Watch for |
|---|---|---|
| Buttons, icon buttons | Button | Pick variant="primary" once per screen. The default size is md. |
| Text links | Link | default for chrome, prose inside sentences. |
| Text fields, labels, errors | Input, Field | Keep the form library. Field wires the ids and the error. |
| Checkboxes, radios, switches | Checkbox, Radio Group, Switch | onCheckedChange or onValueChange receive the value, not an event. |
| Selects | Select, Native Select, Combobox | Native Select when the OS list is better, Combobox when the list needs filtering. |
| Modals | Dialog | Delete hand-rolled focus traps and scroll locks. Radix owns them now. |
| Side panels | Drawer | Blocks the page. Use Sheet for one that stays open over a canvas. |
| Menus | Dropdown Menu, Context Menu | Keep each item's handler as it is. |
| Tooltips, popovers | Tooltip, Popover | Hints in Tooltip, anything interactive in Popover. |
| Toasts, snackbars | Toast | One provider near the root, then one call per message. |
| Banners, inline errors | Alert | Five semantic variants. |
| Tabs, accordions | Tabs, Accordion | Keep URL-synced tabs controlled. |
| Status tags | Badge | Soft tints from the status roles. |
| Spinners, skeletons | Spinner, Skeleton | A loading button takes loading, not a spinner child. |
| Tables, data grids | Data Table | Pro. Keep your query and sorting logic. |
| Date pickers | Date Picker | Pro. |
| Charts | Chart | Pro. Without a license, keep the chart library and color it with tokens. |
| Touch number pads, on-screen keyboards | Keypad, On-Screen Keyboard | Pro. For a screen with no physical keyboard. |
Token map#
| Hard-coded today | Koala token | Notes |
|---|---|---|
| Brand color | bg-brand, text-brand, --brand | One value recolors every brand surface. |
| Page background | bg-background | bg-canvas for the back layer of an app shell. |
| Card or panel fill | bg-card, bg-popover | Only on surfaces that are raised. In-flow containers paint no fill. |
| Main text | text-foreground | Headings and labels. |
| Long reading copy | text-body | Paragraphs. |
| Secondary text | text-muted-foreground | Meta and captions. |
| Borders | border-border, border-input | border-input around controls. |
| Error, success, warning, info | destructive, success, warning, info | A soft tint is bg-success/10 text-success-strong. |
| Border radius | rounded-sm to rounded-2xl | All driven by --radius. |
| Shadows | shadow-xs to shadow-xl | Tuned per theme. |
| Transitions | duration-fast, duration-base, ease-out | Name the property: transition-colors, never transition-all. |
Keeping both working#
- Unlayered CSS wins. Tailwind’s utilities live in a cascade layer, so a global
button { },a { }or* { }rule in your old stylesheet beats every Koala class. Scope those rules to the old components, or move them into@layer base. - Tailwind resets the page. On a project that had no Tailwind, its base styles strip the default look from headings, lists and links. Check the old pages right after adding it.
- Token names can collide.
initwarns about your own--background,--foregroundand--radius. Rename yours or remove them, or they override Koala’s themes. - A kit’s theme provider stays until its last component is gone. It can wrap the same tree as Koala’s
ThemeProvider.
All of this is temporary: side by side is how the migration runs, never how it ends.
Step 7: Leave nothing behind#
The migration ends when every line below is true. Work through them in order.
- Delete the old interface.
components/legacy/, old stylesheets, themes, icon fonts, images no screen uses, and vendored files inpublic/. - Delete what overrode it.
!importantrules, global element selectors, andclassNameoverrides that only existed to fight the old look. - Remove the packages. The old kit, jQuery and its plugins, Sass, old build tools and icon libraries, from
package.jsonand the lockfile. Remove their CDN tags too. - Remove the scaffolding. Compatibility wrappers, feature flags for the old interface, unused exports and dead routes.
- Prove it. Run the commands below, the project’s checks, the smoke tests and a production build. Then capture every screen again into
koala-migration/after/and compare it withbefore/. - Report. Add to
koala-migration.mdwhat was removed, what is left and why, and how to go back. Keepkoala.jsonin git:diffandupdateuse it to bring in fixes. Then ask the owner to review the branch.
# Unused files, exports and packages
npx knip
# Styles that fight the system: fix every hit, or note why it stays
grep -rnE '!important|style=\{\{' src app components --exclude-dir=ui
# Scripts and stylesheets still loaded from outside
grep -rnE '<(script|link)[^>]+https?://' index.html public app src
# Koala's own files, untouched
npx koalaui-cli@latest diff