# Migrate

Move a screen to PixilUI one item at a time. Both libraries install with the same CLI and land in their own folders, so they run side by side while you switch.

## From shadcn/ui

### Before you start

- Nothing is replaced on install. shadcn/ui lives in `components/ui/`, PixilUI in `components/pixilui/`, and neither overwrites the other.
- PixilUI reads its own tokens from `foundation.css`, not your shadcn/ui theme variables. A PixilUI button next to a shadcn/ui card will use the PixilUI colors, radii and shadows. The [theming page](https://pixilui.com/docs/theming) says how to point the PixilUI roles at your brand.
- PixilUI overlays use Base UI, not Radix. They do not share context with Radix components, so move a dialog and the buttons inside it together.
- Migrate a whole screen at a time. Mixing the two sets of tokens on one surface is the one thing that looks wrong.

### What maps to what

| shadcn/ui | PixilUI | What changes |
| --- | --- | --- |
| `Button` | [`button`](https://pixilui.com/components/button) | `variant`: `default` is `primary` (write it: the PixilUI default is the `secondary` glass), `destructive` is `danger`, `secondary` and `link` keep their names, `ghost` is `tertiary`. `outline` has no match: use `secondary`. `size`: `sm` is `sm` (28) or `lg` (36), `default` is `lg` (36), `lg` is `xl` (44). `loading` shows a spinner in place of the icon and keeps focus; icons go in `icon` and `iconEnd`, not in the children. |
| `Dialog` | [`dialog`](https://pixilui.com/components/dialog) | The trigger is a prop (`trigger={<Button>…</Button>}`), the content is the children. `DialogTitle` and `DialogDescription` keep their names. `DialogFooter` with two buttons becomes `DialogActions confirm="Delete agent" onConfirm={…}`, which shows pending and error itself when `onConfirm` returns a promise. |
| `AlertDialog` | [`dialog`](https://pixilui.com/components/dialog) with `variant="danger"` | One component for both. If the thing being confirmed is an action an agent wants to take, use [`approval-card`](https://pixilui.com/components/approval-card) instead. |
| `Sheet`, `Drawer` | [`drawer`](https://pixilui.com/components/drawer) | `side` is `right`, `left` or `bottom` (no `top`). `DrawerTitle`, `DrawerDescription`, `DrawerActions` and `DrawerClose` match the dialog parts. |
| `Popover` | [`popover`](https://pixilui.com/components/popover) | The trigger is a prop; `side`, `align` and `offset` work as in shadcn/ui. `PopoverTitle`, `PopoverDescription` and `PopoverClose` are optional. |
| `Tooltip` | [`tooltip`](https://pixilui.com/components/tooltip) | The text is `label`, the control is the child, and `shortcut` shows the key. `TooltipProvider` is optional: a lone tooltip groups itself. |
| `Input`, `Label` | [`input`](https://pixilui.com/components/input) | Replaces the input, its label and the help line: `label`, `description` and `error` are props and are wired to the field for screen readers. `prefix`, `suffix` and `clearable` replace hand-built adornments. |

The AI parts of a screen usually have no shadcn/ui equivalent: an approval step before the agent acts, the steps of a run, tool calls, a thinking line, a streaming answer. See the [AI Elements guide](https://pixilui.com/docs/migrate#ai-elements) if you built those with AI Elements, or start from [components](https://pixilui.com/components).

### Steps

#### 1. Add the registry and the foundation

```bash
npx pixilui@latest init
```

This adds `@pixilui` to `registries` in `components.json` next to your other entries, installs the foundation and writes the agent rules. Your `components/ui/` folder is not touched.

#### 2. Add the items the screen needs

```bash
npx pixilui@latest add button dialog input
```

#### 3. Swap the imports on one screen

```tsx
// Before
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger } from "@/components/ui/dialog";

// After
import { Button } from "@/components/pixilui/button";
import { Dialog, DialogActions, DialogDescription, DialogTitle } from "@/components/pixilui/dialog";
```

A search for `@/components/ui/button` in that screen's folder finds every place to change.

#### 4. Change the props

```tsx
// Before
<Dialog>
  <DialogTrigger asChild>
    <Button variant="destructive">Delete agent</Button>
  </DialogTrigger>
  <DialogContent>
    <DialogTitle>Delete the Billing agent?</DialogTitle>
    <DialogDescription>Its 214 runs and 3 schedules go with it.</DialogDescription>
    <DialogFooter>
      <Button variant="outline">Cancel</Button>
      <Button variant="destructive" disabled={pending} onClick={remove}>Delete agent</Button>
    </DialogFooter>
  </DialogContent>
</Dialog>

// After
<Dialog variant="danger" trigger={<Button variant="secondary">Delete agent</Button>}>
  <DialogTitle>Delete the Billing agent?</DialogTitle>
  <DialogDescription>Its 214 runs and 3 schedules go with it.</DialogDescription>
  <DialogActions confirm="Delete agent" onConfirm={remove} />
</Dialog>
```

`remove` returns a promise; the dialog shows the pending state, closes on success and shows the error on failure. Drop the `pending` state and the `disabled` flag you kept for it.

#### 5. Check the tokens around it

Classes you wrote around the components keep working, but replace shadcn/ui theme classes on the same surface with the PixilUI roles: `bg-card` becomes `bg-surface`, `text-muted-foreground` becomes `text-secondary`, `border` stays `border-border`. In a shadcn/ui app, `bg-accent` is the grey hover of menus; the PixilUI brand fill is `bg-accent-solid`.

#### 6. Remove what nothing imports

When no file imports `components/ui/dialog` any more, delete it. Keep the shadcn/ui components you still use, such as tables, forms and menus; they are fine next to PixilUI.

### With an agent

Paste this into Claude Code, Cursor or Codex:

```text
Read the From shadcn/ui part of https://pixilui.com/docs/migrate/markdown. Move the settings screen from shadcn/ui Button, Dialog and Input to PixilUI using that mapping, one file at a time, and list what you changed.
```

## From AI Elements

**AI Elements is moving into shadcn/ui.** Its site says the standalone project is deprecated at the end of November 2026 and recommends that new projects install it from shadcn/ui. What you installed keeps working: it is source in `components/ai-elements/`.

This part moves the agent parts (tool calls, approvals, reasoning and runs) to PixilUI, one part at a time, and keeps the rest of AI Elements where it is.

### What the deprecation means for your project

| Question | Answer |
| --- | --- |
| Do my installed AI Elements components stop working? | No. They are files in `components/ai-elements/`, not a package that can be switched off. |
| Where do new installs come from? | The AI Elements site recommends installing it from shadcn/ui for new projects (ui.shadcn.com/docs/ai-elements). |
| Do I have to move anything before 30 November 2026? | No. Move a part when you want a different design or behavior for it, or when you add a new screen. |
| What should replace the chat shell? | AI Elements from shadcn/ui, or another chat library such as assistant-ui or prompt-kit. PixilUI has no conversation, message list or prompt input yet. |
| What can PixilUI replace? | Tool, Confirmation, Reasoning, Loader, Response, Task, Chain of Thought and Plan, as mapped below. |

### Before you start

- PixilUI items take plain props, not AI SDK message parts. You map each part to props in a line or two (examples below), which also means the items work with any SDK or your own stream.
- AI Elements lives in `components/ai-elements/`, PixilUI in `components/pixilui/`. Neither overwrites the other.
- PixilUI reads its own tokens from `foundation.css`. Move a whole message or panel at a time so one surface never mixes the two looks.

### What maps to what

| AI Elements | PixilUI | What changes |
| --- | --- | --- |
| `Tool` and its parts | [`tool-call-row`](https://pixilui.com/components/tool-call-row) | One component for `Tool`, `ToolHeader`, `ToolContent`, `ToolInput` and `ToolOutput`. Map the part's `state` to `status` (see below), pass `input`, `output` and `errorText` as `input`, `output` and `error`. Write `summary` as what the call did in plain words. Wrap the calls of one message in `ToolCallRowGroup`. |
| `Confirmation` and its parts | [`approval-card`](https://pixilui.com/components/approval-card) | Show what the agent will do as `items` rows with a `risk`. `onApprove` and `onReject` send the approval response; return the promise and the card shows pending, then folds into a receipt. |
| `Reasoning` | [`thinking-state`](https://pixilui.com/components/thinking-state) | `isStreaming` becomes `done={!isStreaming}`; the timer runs from `startedAt`. Pass short steps instead of the raw reasoning text, or keep `Reasoning` if you show the full text. |
| `Loader`, `Shimmer` | [`thinking-state`](https://pixilui.com/components/thinking-state) | While waiting for the first token: a line that says what the agent is doing, with a live timer, instead of a spinner. |
| `Response`, `MessageResponse` | [`streaming-text`](https://pixilui.com/components/streaming-text) | `text` and `streaming`; only new words animate and half-arrived words wait. It renders plain text with inline code, not full markdown: keep `Response` for answers with lists, tables or code blocks. |
| `Task`, `ChainOfThought`, `Plan` | [`run-timeline`](https://pixilui.com/components/run-timeline) | Steps with `id`, `title`, `detail` and `status` (`pending`, `active`, `done`, `error`, `waiting`). A `waiting` step holds an approval card. |
| `Conversation` and the rest | None yet | Keep AI Elements or shadcn/ui for `Conversation`, `Message`, `PromptInput`, `CodeBlock`, `Sources`, `InlineCitation`, `WebPreview` and `Canvas`. The [roadmap](https://pixilui.com/changelog#roadmap) lists what is planned. |

### Steps

#### 1. Add the registry and the foundation

```bash
npx pixilui@latest init
```

This adds `@pixilui` next to `@ai-elements` in `components.json`, installs the foundation and writes the agent rules.

#### 2. Add the items

```bash
npx pixilui@latest add tool-call-row approval-card thinking-state
```

#### 3. Map the message parts to props

Where you render a tool part today:

```tsx
// Before
<Tool>
  <ToolHeader type={part.type} state={part.state} />
  <ToolContent>
    <ToolInput input={part.input} />
    <ToolOutput output={part.output} errorText={part.errorText} />
  </ToolContent>
</Tool>

// After
import { ToolCallRow, type ToolCallRowValue } from "@/components/pixilui/tool-call-row";

const status = (state: string) => (state === "output-error" ? "error" : state === "output-available" ? "done" : "running");

<ToolCallRow
  name={part.type.replace(/^tool-/, "")}
  summary={describe(part)}
  status={status(part.state)}
  input={part.input as ToolCallRowValue}
  output={part.output as ToolCallRowValue}
  error={part.errorText}
/>
```

`describe` is yours: one short past-tense line per tool ("Found 3 overdue invoices for Northwind"). It is the line people read, so it is worth writing.

For reasoning:

```tsx
// Before
<Reasoning isStreaming={status === "streaming"}>
  <ReasoningTrigger />
  <ReasoningContent>{part.text}</ReasoningContent>
</Reasoning>

// After
<ThinkingState label="Reading the incident timeline" startedAt={startedAt} done={status !== "streaming"} />
```

#### 4. Replace the approval step

Where an AI Elements `Confirmation` asks before a tool runs, render an approval card and send the same response from its callbacks:

```tsx
<ApprovalCard
  title="Send 7 renewal reminders"
  risk="medium"
  items={[
    { label: "Audience", value: "7 customers with a card expiring in November" },
    { label: "Cost", value: "$0.42", numeric: true },
  ]}
  onApprove={() => respond({ id: part.approval.id, approved: true })}
  onReject={(note) => respond({ id: part.approval.id, approved: false, reason: note })}
/>
```

`respond` is the approval call your SDK gives you; with the AI SDK it is the approval response helper from `useChat`. Return its promise so the card shows its own pending state.

#### 5. Keep the rest

Leave `Conversation`, `Message`, `PromptInput` and the other parts with no match where they are. Remove an AI Elements file only when nothing imports it.

### With an agent

Paste this into Claude Code, Cursor or Codex:

```text
Read the From AI Elements part of https://pixilui.com/docs/migrate/markdown. In the chat page, replace the AI Elements Tool, Confirmation and Reasoning parts with PixilUI tool-call-row, approval-card and thinking-state using that mapping. Keep everything else. List what you changed.
```

## Next steps

- [Theming](https://pixilui.com/docs/theming): point the roles at your brand.
- [Approval card](https://pixilui.com/components/approval-card): the usual first item.
- [Use with your agent](https://pixilui.com/docs/agents): let the agent do the swap.
