# Upgrade Guide

URL: https://ark-ui.com/docs/react/overview/upgrade-guide
Markdown: https://ark-ui.com/docs/react/overview/upgrade-guide.md

What changed in Ark UI v6, and the breaking changes to fix as you migrate.

---

---
id: upgrade-guide
title: Upgrade Guide
description: What changed in Ark UI v6, and the breaking changes to fix as you migrate.
---

v6 adds a `render` function that can read a part's state, merges the `data-scope`/`data-part` attributes, and lines the
four frameworks up on the same anatomy. `asChild` still works. Codemods handle most of the work. This guide covers what
they don't.

## Before you start

- **Solid** requires Solid 2. See [Solid 2](#solid-2).
- Commit your work. The codemods won't run on a dirty working tree.

## Run the codemods

```sh
# List every transform
npx @ark-ui/codemod list

# Preview a transform without writing files
npx @ark-ui/codemod react/as-child-to-render "src/**/*.tsx" --dry
```

- `--dry` prints a diff and writes nothing.
- Anything ambiguous is skipped and reported with a file and a reason.
- Add `--cross-file` when parts come through local barrels, re-exports or wrappers like `styled(ark.button)`.

Each transform exists for `react/*`, `solid/*`, `svelte/*` and `vue/*`:

| Transform                  | Change                                                                     |
| -------------------------- | -------------------------------------------------------------------------- |
| `as-child-to-render`       | `asChild` → `render` (optional)                                            |
| `carousel-props`           | `slideCount` → `count`, `autoplay` → `autoPlay`, `padding` → `itemSpacing` |
| `floating-panel-placement` | `resizeTriggerAxes` → `resizeTriggerPlacements`, `axis` → `placement`      |
| `image-cropper-placement`  | `handles` → `placements`, `position` → `placement`                         |
| `tabs-virtual-focus`       | `composite` → `virtualFocus` (value inverted)                              |
| `popover-portalled`        | removes `portalled`                                                        |
| `tags-input-editable`      | adds `editable` to keep the old default                                    |
| `pin-input-count`          | `length` → `count`, or flags a missing `count`                             |
| `field-indicator`          | `Field.RequiredIndicator` → `Field.Indicator type="required"`              |

Stylesheets and selectors have their own transform:

```sh
npx @ark-ui/codemod css/data-attributes "src/**/*.{css,ts,tsx,vue,svelte}" --dry
```

Everything else in this guide is a manual change.

## Migrate with an AI agent

Paste this prompt into an agent (Claude Code, Cursor, Copilot) pointed at your codebase.

```text
Migrate this codebase from Ark UI v5 to v6. Detect the framework (React, Solid,
Svelte or Vue) and change only Ark UI usage. Run the typecheck after each step.
Report anything ambiguous instead of guessing.

1. Run the codemods and review their reports:
   npx @ark-ui/codemod list
   npx @ark-ui/codemod css/data-attributes "src/**/*.{css,ts,tsx,vue,svelte}"
   Add --cross-file if parts come through barrels, re-exports or wrappers.

2. Leave `asChild` as is; it is still supported. Where a part needs its
   state, use `render`, which receives (props, state). React and Vue: spread
   or v-bind `props`, an object. Solid/Svelte: `props` is a merge function, so
   spread `props()` and call `props({ onClick })` to merge handlers. Solid's
   `state` is an accessor.

3. Toaster: remove `render`/`asChild` and `ToasterState`. Style it with CSS.

4. Parts that now render `span` or `h2` (see the guide): add `display` where
   styles assumed a block. React refs become HTMLSpanElement.

5. Overlays: move `z-index` from content to the positioner, using
   `calc(<base> + var(--layer-index))`.

6. Apply the component changes in the guide: Accordion, Combobox/Listbox/
   Select (`List` part, `Empty` placement), Field, Menu, NumberInput,
   PinInput, Popover, Slider, Steps, TagsInput, Toc, Tour, and the
   "previous" renames.

7. Solid: upgrade to Solid 2. Solid/Svelte/Vue: `useCollator`/`useFilter`
   return values, not accessors. Svelte: pass `id` to `useX` hooks and update
   renamed exports. Vue: update AngleSlider type names and NumberInput v-model.

Full guide: https://ark-ui.com/docs/overview/upgrade-guide
```

## Composition

### `render` alongside `asChild`

`asChild` still works, so this change is optional. `render` receives the part's props and its state, so you can read
state inline. React and Vue move the child into a function or slot. In Solid and Svelte, `props` is a function: call it
to spread, and pass your handlers to merge them instead of overwriting. In Vue, `props` is an object to `v-bind`.

Codemod (optional): `<framework>/as-child-to-render`.

**Before**

```tsx
<Collapsible.Trigger asChild>
  <button>Toggle</button>
</Collapsible.Trigger>
```

**After (React)**

```tsx
<Collapsible.Trigger render={(props, state) => <button {...props}>{state.open ? 'Open' : 'Closed'}</button>} />
```

**After (Solid)**

```tsx
<Collapsible.Trigger render={(props, state) => <button {...props()}>{state().open ? 'Open' : 'Closed'}</button>} />
```

**After (Svelte)**

```svelte
<Collapsible.Trigger>
  {#snippet render(props, state)}
    <button {...props()}>{state.open ? 'Open' : 'Closed'}</button>
  {/snippet}
</Collapsible.Trigger>
```

**After (Vue)**

```vue
<Collapsible.Trigger>
  <template #render="{ props, state }">
    <button v-bind="props">{{ state.open ? 'Open' : 'Closed' }}</button>
  </template>
</Collapsible.Trigger>
```

### `Toaster` is no longer polymorphic

`Toaster` drops `render`, `asChild` and `ToasterState`. Its children belong to the machine, and handing them over
dropped toasts. Style the group with `data-placement`, `data-side` and `data-align`, or wrap your own element around it.

## Styling and markup

### Data attributes are merged

`data-scope`, `data-part` and `data-ownedby` become one attribute per part, `data-{scope}-{part}`. Your JSX doesn't
change. Your CSS and `querySelector` calls do.

Codemod: `css/data-attributes`. It also turns toggle `[data-state="on"]` into `[data-pressed]`, and replaces the removed
`data-focus` on toggle group and toolbar with `:focus-within` / `:focus-visible`.

**Before**

```css
[data-scope='dialog'][data-part='trigger'] {
  /* ... */
}
```

**After**

```css
[data-dialog-trigger] {
  /* ... */
}
```

The codemod skips selectors built from variables, with escaped quotes, or where scope and part aren't adjacent. Update
those by hand.

Some parts were renamed:

| Component                    | v5                                      | v6                                                               |
| ---------------------------- | --------------------------------------- | ---------------------------------------------------------------- |
| TreeView                     | `branch`                                | `node-group`                                                     |
| TreeView                     | `branch-control`, `item`                | `node` (`[data-branch]` on branches)                             |
| TreeView                     | `branch-content`, `branch-indent-guide` | `node-group-content`, `indent-guide`                             |
| TreeView                     | `branch-indicator`, `branch-trigger`    | `node-indicator`, `node-expand-trigger`                          |
| TreeView                     | `branch-text`, `item-text`              | `node-text`                                                      |
| TreeView                     | `item-indicator`                        | removed, use `node-indicator`                                    |
| TreeView                     | `node-checkbox-indicator`               | `node-indicator` with `type="checked"` or `type="indeterminate"` |
| ImageCropper handle          | `[data-position="nw"]`                  | `[data-placement="nw"]`                                          |
| FloatingPanel resize trigger | `[data-axis="n"]`                       | `[data-placement="n"]`                                           |
| Field                        | `input`, `textarea`, `select`           | `control`                                                        |
| Field                        | `required-indicator`                    | `indicator`                                                      |
| Toc nav                      | `[data-toc-root]`                       | `[data-toc-nav]`                                                 |

- The codemod renames all of these except `item-indicator`, `node-checkbox-indicator` and the Toc nav. It renames
  `data-position` and `data-axis` only right after the handle or resize trigger selector.
- A v5 `item` or `branch-control` selector becomes two attribute selectors, which raises specificity. Check overrides
  that relied on order.
- JsonTreeView uses the tree view's attributes: `[data-scope="json-tree-view"][data-part="branch"]` →
  `[data-tree-view-node-group]`.

### Some parts render a different element

Parts inside a `button` or `label` now render `span`, since a `div` there is invalid HTML. A few others changed to match
the same part in other frameworks. A `span` is inline, so width, height and `transform` stop applying until you set
`display`. In React, the refs are `HTMLSpanElement`.

**Before**

```css
[data-accordion-item-indicator] {
  transition: transform 0.2s;
}
```

**After**

```css
[data-accordion-item-indicator] {
  display: inline-flex;
  transition: transform 0.2s;
}
```

Now `span`:

- `Accordion.ItemIndicator`, `Collapsible.Indicator`, `Popover.Indicator`, `Toggle.Indicator`
- `Select.Indicator`, `Select.ItemIndicator`, `Combobox.ItemIndicator`, `Listbox.ItemIndicator`, `Listbox.ItemText`
- `Menu.Indicator`, `Menu.ItemIndicator`, `NavigationMenu.ItemIndicator`
- `Checkbox.Control`, `Checkbox.Indicator`, `RadioGroup.ItemControl`, `SegmentGroup.ItemControl`
- `Clipboard.Indicator`, `Steps.Indicator`, `Splitter.ResizeTriggerIndicator`
- `Avatar.Root`, `Avatar.RootProvider`, `Tabs.Indicator`, `NumberInput.Scrubber`
- `AngleSlider.Marker`, `AngleSlider.ValueText`

Now `h2`: `Popover.Title`, like `Dialog.Title`. Without a CSS reset it picks up the browser's heading margins and font
size. Use `render` for another heading level.

### Overlays no longer set a `z-index`

Popover, Menu, Select, Combobox, Tooltip, HoverCard, DatePicker, ColorPicker, Dialog, Drawer, Tour, FloatingPanel and
Toast no longer put an inline `z-index` on their content. Set it on the positioner or backdrop. Each exposes
`--layer-index`, its position among open layers, so nested overlays stay above their parent.

**Before**

```css
[data-popover-content] {
  z-index: 1400;
}
```

**After**

```css
[data-popover-positioner] {
  z-index: calc(1400 + var(--layer-index));
}
```

- Dialog and Drawer: `--z-index` is gone. Use `--layer-index` on the backdrop and positioner.
- FloatingPanel: style the positioner the same way to raise the focused panel.
- Tour: style the positioner with `--tour-layer`.
- Toast: set `z-index` on `[data-toast-group]`.

## Components

### Accordion

- `loopFocus` is removed. Triggers are reached with `Tab`.
- `collapsible` defaults to `true`. Pass `collapsible={false}` to keep one item open.

### Combobox, Listbox and Select

The listbox role, active descendant and keyboard focus move from `Content` to a new `List` part. `Content` becomes a
plain wrapper, so headers, footers and search inputs can sit in the popup. `Empty` moves out of `List` and stays mounted
with `role="status"`, so screen readers announce it. Put its message in a child element.

**Before**

```tsx
<Combobox.Content>
  <Combobox.Empty className={styles.Empty}>No results found</Combobox.Empty>
  {items.map((item) => (
    <Combobox.Item key={item.value} item={item}>
      {item.label}
    </Combobox.Item>
  ))}
</Combobox.Content>
```

**After**

```tsx
<Combobox.Content>
  <Combobox.Empty>
    <div className={styles.Empty}>No results found</div>
  </Combobox.Empty>
  <Combobox.List>
    {items.map((item) => (
      <Combobox.Item key={item.value} item={item}>
        {item.label}
      </Combobox.Item>
    ))}
  </Combobox.List>
</Combobox.Content>
```

| v5                  | v6                   |
| ------------------- | -------------------- |
| `composite={false}` | `popupType="dialog"` |
| `disableLayer`      | `inline` (Combobox)  |

For loading and error states, use the new `Status` part.

### Field and Fieldset

`Field` and `Fieldset` now run on `@zag-js/field` and `@zag-js/fieldset`, with native validation, a `validate` function,
`validationMode` and server `errors`. Most usage keeps working.

Codemods: `<framework>/field-indicator` and `css/data-attributes`.

**Before**

```tsx
<Field.Label>
  Email
  <Field.RequiredIndicator>*</Field.RequiredIndicator>
</Field.Label>
```

**After**

```tsx
<Field.Label>
  Email
  <Field.Indicator type="required">*</Field.Indicator>
</Field.Label>
```

- Generated ids are `{id}:label` and `{id}:control`.
- `Field.ErrorText` stays mounted with `hidden` while the field is valid. Style it with `[hidden]`.
- `Field.Root` no longer sets `role="group"`.

### Menu

`composite` is replaced by `popupType`.

### NumberInput

The value is a `number`, with `null` for an empty input. The input is a text field instead of a spinbutton.

**Before**

```tsx
<NumberInput.Root onValueChange={(details) => setValue(details.valueAsNumber)}>
```

**After**

```tsx
<NumberInput.Root onValueChange={(details) => setValue(details.value)}>
```

| v5                                   | v6                |
| ------------------------------------ | ----------------- |
| `valueAsNumber`                      | `value`           |
| `allowOverflow` / `clampValueOnBlur` | `allowOutOfRange` |
| Vue `v-model`: `string`              | `number \| null`  |

### PinInput

| v5                                | v6                                 |
| --------------------------------- | ---------------------------------- |
| `length`                          | `count` (codemod)                  |
| `sanitizeValue`                   | `normalizeValue`                   |
| `blurOnComplete`, `selectOnFocus` | removed; blur in `onValueComplete` |

### Popover

The `portalled` prop and `api.portalled` are gone. The popover detects whether its content is portalled and fixes tab
order either way. To portal it, wrap the positioner in `Portal`.

Codemod: `<framework>/popover-portalled` removes the prop. Add the `Portal` yourself.

**Before**

```tsx
<Popover.Root portalled>
  <Popover.Trigger>Open</Popover.Trigger>
  <Popover.Positioner>
    <Popover.Content>...</Popover.Content>
  </Popover.Positioner>
</Popover.Root>
```

**After**

```tsx
<Popover.Root>
  <Popover.Trigger>Open</Popover.Trigger>
  <Portal>
    <Popover.Positioner>
      <Popover.Content>...</Popover.Content>
    </Popover.Positioner>
  </Portal>
</Popover.Root>
```

### Slider

The `aria-label` and `aria-labelledby` arrays are replaced by `getAriaLabel` and `getAriaLabelledBy` functions.

### Steps

Steps come from an `items` array and are addressed by a string `value`, not a `count` and an index. Each item can be
`optional`, `invalid`, `disabled` or `editable`, and carry a `title` and `description`.

**Before**

```tsx
<Steps.Root count={3} defaultStep={0} onStepChange={(details) => setStep(details.step)}>
  <Steps.List>
    <Steps.Item index={0}>
      <Steps.Trigger>Shipping</Steps.Trigger>
    </Steps.Item>
  </Steps.List>
  <Steps.Content index={0}>...</Steps.Content>
</Steps.Root>
```

**After**

```tsx
const items = [{ value: 'shipping' }, { value: 'gift', optional: true }, { value: 'payment' }]

<Steps.Root items={items} defaultValue="shipping" onValueChange={(details) => setStep(details.value)}>
  <Steps.List>
    <Steps.Item value="shipping">
      <Steps.Trigger>Shipping</Steps.Trigger>
    </Steps.Item>
  </Steps.List>
  <Steps.Content value="shipping">...</Steps.Content>
</Steps.Root>
```

| v5                                     | v6                                            |
| -------------------------------------- | --------------------------------------------- |
| `count`                                | `items`                                       |
| `step` / `defaultStep`                 | `value` / `defaultValue`                      |
| `onStepChange` / `onStepComplete`      | `onValueChange` / `onComplete`                |
| `isStepValid` / `isStepSkippable`      | `invalid` / `optional` on the item            |
| `onStepInvalid`                        | `onNavigationBlocked` (`reason`, `blockedBy`) |
| `index` on parts                       | `value`                                       |
| `api.setStep(index)`                   | `api.setValue(value)`                         |
| `api.isCompleted`                      | `api.complete`                                |
| `Steps.ChangeDetails`                  | `Steps.ValueChangeDetails`                    |
| `Steps.InvalidDetails`                 | `Steps.NavigationBlockedDetails`              |
| `--percent`                            | `--steps-percent`                             |
| Vue `v-model:step`, Svelte `bind:step` | `v-model`, `bind:value`                       |

- `Steps.SkipTrigger` skips an `optional` step, and `completedValues` makes completed steps controllable.
- A step the user goes back to stays complete, so it can carry `data-current` and `data-complete` together. Put the
  current-step style last, or scope the completed one with `:not([data-current])`.

### TagsInput

Tags open for editing on double-click only when you pass `editable`.

Codemod: `<framework>/tags-input-editable`.

**Before**

```tsx
<TagsInput.Root>
```

**After**

```tsx
<TagsInput.Root editable>
```

### Toc

- `multiple` defaults to `false`.
- `Toc.Nav` renders its own props: it carries `data-toc-nav` and an `id`, and takes `aria-labelledby` from `Root`.
- Svelte: `Toc.Nav` reads the Toc from `Toc.Root` and no longer accepts `useToc` props. Wrap it in `Toc.Root`.

### Tour

The `"prev"` action is now `"previous"`.

### "Previous" is spelled out

Context and hook APIs use `previous` instead of `prev`. Part names like `Pagination.PrevTrigger` don't change.

| v5                               | v6                                       |
| -------------------------------- | ---------------------------------------- |
| `getPrevTriggerProps()`          | `getPreviousTriggerProps()`              |
| `goToPrevPage()`                 | `goToPreviousPage()`                     |
| `translations.prevTriggerLabel`  | `translations.previousTriggerLabel`      |
| `goToPrevStep()` / `hasPrevStep` | `goToPreviousStep()` / `hasPreviousStep` |
| `selectPrev()`                   | `selectPrevious()`                       |
| `scrollPrev()`                   | `scrollPrevious()`                       |

### Part state types

These keep their names but now describe the root state: `CollapsibleTriggerState`, `EditableAreaState`,
`EditableInputState`, `EditableLabelState`, `EditablePreviewState`, `DateInputControlState`, `PasswordInputInputState`,
`PasswordInputVisibilityTriggerState`, `PinInputLabelState` and `RatingGroupControlState`.

## Frameworks

### Solid 2

`@ark-ui/solid` requires `solid-js` and `@solidjs/web` `>=2.0.0-rc.19`, and no longer works with Solid 1.

```sh
npm install solid-js@next @solidjs/web@next
```

**Before**

```json
{ "compilerOptions": { "jsxImportSource": "solid-js" } }
```

**After**

```json
{ "compilerOptions": { "jsxImportSource": "@solidjs/web" } }
```

### `useCollator` and `useFilter` return values

In Solid, Svelte and Vue, these hooks return values instead of accessors, like React. They still follow locale changes.

**Before**

```ts
const collator = useCollator()
collator().compare(a, b) // Solid, Svelte
collator.value.compare(a, b) // Vue

const filters = useFilter({ sensitivity: 'base' })
filters().contains(text, query)
```

**After**

```ts
const collator = useCollator()
collator.compare(a, b)

const { contains } = useFilter({ sensitivity: 'base' })
contains(text, query)
```

### Svelte: hooks require an `id`

Without an `id`, two instances generated the same element ids. Components like `<Collapsible.Root>` still create their
own. `$props.id()` can be called once per component, so derive from it if you need two.

**Before**

```ts
const collapsible = useCollapsible()
```

**After**

```ts
const id = $props.id()
const collapsible = useCollapsible({ id })
```

### Svelte: exports match the other frameworks

| v5                                          | v6                                               |
| ------------------------------------------- | ------------------------------------------------ |
| `Positioner`, `Root`, `Title`… (Dialog)     | `DialogPositioner`, `DialogRoot`, `DialogTitle`… |
| `StepsStepChangeDetails`                    | `StepsValueChangeDetails`                        |
| `ColorPickerColor`                          | `Color`                                          |
| `TabsContentState` / `TabsTriggerState`     | `TabContentState` / `TabTriggerState`            |
| `CheckboxProvider`, `splitCollapsibleProps` | removed (internal)                               |

### Vue: type names

- `AngleSlider` uses short type names like the other components: `AngleSlider.AngleSliderRootProps` →
  `AngleSlider.RootProps`.
- `RootEmits` types are now exported for AngleSlider, Drawer, FloatingPanel, JsonTreeView, PasswordInput, SignaturePad,
  Steps and TreeView.
