cnippet/ui
  1. docs
  2. handbook
  3. migration

guides

Migrating from shadcn/ui

Move a shadcn/ui (Radix) project to cnippet ui one component at a time — renamed parts, changed props, data attributes and CSS variables.

cnippet ui uses the same CLI, the same components/ui/ folder, the same cn helper and the same token names as shadcn/ui. What changes is the layer underneath: components are built on Base UI instead of Radix, so some parts and props have different names.

You don't have to switch everything at once. Both libraries read the same CSS variables, so shadcn/ui and cnippet ui components can live side by side while you migrate.

Before you start

  • Tailwind CSS v4. cnippet ui doesn't support v3. Upgrade first with the Tailwind CSS upgrade guide.
  • Commit your work. Replacing a component overwrites its file. If you edited shadcn/ui components, you'll want to see those edits in the diff.
  • Run the type checker. Most breaking changes are prop renames, and tsc points to each call site you need to fix.

Step by step

Add the cnippet ui tokens

This replaces your color variables with the cnippet ui values and adds info, success and warning. The shadcn/ui token names (--primary, --muted, --border, …) stay the same, so existing components keep working.

Replace one component

Pick a component and overwrite it with the cnippet ui version:

Start with a simple one that's used a lot, such as Button or Badge, then move to overlays and form controls.

Fix the call sites

Run tsc --noEmit, then fix each error with the tables below. Many shadcn/ui part names still work as aliases, so a lot of code needs no changes at all.

Repeat, then remove Radix

When no file imports @radix-ui/* any more, uninstall those packages and anything else only the old components used, such as cmdk, sonner, vaul and input-otp.

asChild becomes render

This is the change you'll make most often. Move the child element into render, and keep its content as the children of the outer component:

See Composition for everything render can do.

Component names

Names that still work

These shadcn/ui names are exported as aliases, so imports keep working. Switch to the new name when you touch the code.

The DropdownMenu* aliases live in @/components/ui/menu, HoverCard* in @/components/ui/preview-card, and ButtonGroup* in @/components/ui/group. Update the import paths when you replace those files.

Components that changed

Not available yet

aspect-ratio, menubar, navigation-menu, resizable and native-select have no cnippet ui version. Keep the shadcn/ui ones. They work next to cnippet ui components.

Props that changed

onOpenChange, onValueChange and onCheckedChange keep their names. They get a second eventDetails argument, which you can ignore.

Data attributes

Radix puts most state in data-state. Base UI uses one attribute per state. Update custom classes that target them:

Animations

shadcn/ui animates popups with tw-animate-css classes like data-[state=open]:animate-in data-[state=closed]:fade-out-0. Base UI uses transitions between data-starting-style and data-ending-style:

CSS variables

Things that work differently

  • Dialogs include more. DialogPopup and SheetPopup render the portal, backdrop and close button for you. Remove your own DialogPortal, DialogOverlay and close buttons, or pass showCloseButton={false}.
  • Dialogs become bottom sheets on phones. Turn it off with bottomStickOnMobile={false}.
  • Buttons default to type="button". Add type="submit" to submit buttons.
  • Triggers are unstyled. A bare DialogTrigger or PopoverTrigger is a plain <button>. Use render={<Button />} to style it.
  • Popovers aren't modal. The page stays interactive. Set modal on Popover for the Radix behavior.

Asking an AI assistant to migrate

Assistants know shadcn/ui better than cnippet ui, so give them the docs first. For example:

Add the project rules to your repo so the assistant keeps following them.