Migration - v2 to v3 with an AI agent
How to use this page
Everything below the line is written for an AI coding agent (Claude Code, Cursor, Copilot, Codex, …), not for you. Hand it to the agent as the raw markdown of this page, which the site serves at the same path with a .md extension, and ask it to migrate your project:
claude "Read https://reka-ui.com/docs/guides/migration-v3-agent.md and migrate this project from Reka UI v2 to v3."The agent applies the mechanical rewrites, asks you about the few cases that need a decision, and finishes with a report of what it changed. Review that diff the way you would review a pull request; the human-readable version of the same changes is the Migration to v3 guide.
Reka UI v3 is still in progress, so this page grows as breaking changes land on the v3 branch. Re-run the migration against the latest version of this page when you upgrade to a newer v3 pre-release.
Instructions for the agent
You are migrating a Vue project from Reka UI v2 to Reka UI v3. Work through the sections below in order. Each one says what changed, how to find the affected code, the rules for rewriting it, and how to verify the result. Apply the mechanical rewrites yourself. Where a rule says ask, stop and ask the developer instead of guessing. Do not change anything this page does not ask you to change: apart from the month and year pickers covered in section 6, the color value type covered in section 10 and the date value types covered in section 30, component names, props, slots and v-model bindings are unchanged in v3.
Before you start
- Record a baseline: run the project's type-check, lint and test commands and note what already fails, so you can tell your changes apart from pre-existing failures.
- Upgrade the dependency to the v3 line (
reka-ui@^3, or the exact pre-release the developer asked for) with the project's package manager, and check that any Nuxt module or resolver usage (reka-ui/nuxt,reka-ui/resolver) resolves after the upgrade. - Decide the search scope: every
.vue,.ts,.tsx,.js,.jsx,.css,.scss,.htmland.mdfile in the project's own source, plus shared styling files such ascva/tailwind-variants/class-variance-authoritydefinitions, UnoCSS shortcuts and design-token files. Skipnode_modules, build output and lockfiles.
1. data-state vocabulary
What changed. data-state now answers exactly one of two questions. Disclosure ("is this surface revealed?") is open or closed. Selection ("is this control in its affirmative state?") is checked or unchecked, with indeterminate only on tri-state controls. Both values are always emitted, so data-state is never absent, and qualifiers such as how a surface opened live in their own attribute. Three multi-value machines are exempt: Progress (indeterminate / loading / complete) and the Splitter resize handle (drag / hover / inactive) are unchanged, and Stepper keeps completed but renames active / inactive to current / upcoming.
| Part | v2 | v3 |
|---|---|---|
Toggle, ToggleGroupItem, ToolbarToggleItem | on / off | checked / unchecked |
TabsTrigger, TabsContent | active / inactive | checked / unchecked |
TagsInputItem, TagsInputItemDelete | active / inactive | checked / unchecked |
RatingItemIndicator | active / (absent) | checked / unchecked |
StepperItem, StepperTrigger, StepperSeparator | completed / active / inactive | completed / current / upcoming |
ScrollAreaScrollbar, ScrollAreaThumb, NavigationMenuIndicator | visible / hidden | open / closed |
SplitterPanel | expanded / collapsed / (absent when not collapsible) | open / closed (non-collapsible panels are always open) |
CollapsibleContent | open / closed / (absent on the initial animated mount) | open / closed |
TooltipTrigger, TooltipContent | closed / delayed-open / instant-open | open / closed, plus a boolean data-delayed attribute while open when the open was delayed |
Everything already on open / closed or checked / unchecked / indeterminate | unchanged | unchanged |
How to find it. Search the scope for these patterns (case-sensitive, all of them):
- Tailwind variants:
data-[state=,group-data-[state=,peer-data-[state=, including quoted values such asdata-[state='on']and named groups such asgroup-data-[state=open]/item. - CSS attribute selectors:
[data-state=,[data-state =, with single, double or no quotes. - Presence-only selectors:
[data-state]and:not([data-state]). - JavaScript reads:
dataset.state,getAttribute('data-state'),data-stateinside test assertions and snapshot files.
Rewrite rules.
- Only rewrite a selector or read that targets a Reka UI part: the element is a Reka component, the class or variant is applied to one, or the shared style is consumed by one.
data-stateis a common convention, so custom components and other libraries in the project may emit the same words (open,expanded,active, …); those are out of scope and must stay as they are. When a selector's target is unclear, leave it unchanged and ask, listing the file and line. - For a Reka UI part, the following values map the same way whichever part it is:
on→checked,off→unchecked,visible→open,hidden→closed,expanded→open,collapsed→closed,instant-open→open. delayed-open→openanddata-delayed. In Tailwind:data-[state=delayed-open]:→data-[state=open]:data-[delayed]:(keep anygroup-/peer-prefix and/namesuffix on both variants; on Tailwind 3 the baredata-delayed:form does not exist, so always usedata-[delayed]:). In CSS:[data-state='delayed-open']→[data-state='open'][data-delayed]. If a rule targetedinstant-openspecifically, use[data-state='open']:not([data-delayed])in CSS.active/inactivedepend on the component the selector styles, so decide per selector, not per file:- Tabs, TagsInput or Rating →
checked/unchecked. - Stepper →
current/upcoming(completedis unchanged). - The Splitter resize handle → keep
inactiveas it is. - Work out the component from the element the class or selector applies to: the Reka component it is rendered on, the component name in a
cva/ variants object or its consumer, a class name such as.TabsTriggeror.StepperItem, or the surrounding markup. A shared variants file that serves both Tabs and Stepper must be split so each gets its own value. If you cannot tell which component a selector styles, leave it unchanged and ask, listing the file and line.
- Tabs, TagsInput or Rating →
- Presence-only selectors on a Reka UI part: because both values are now always present,
[data-state]matches every part and:not([data-state])matches nothing. Rewrite them to the explicit value they were standing in for: an unlitRatingItemIndicatorisunchecked, a non-collapsibleSplitterPanelisopen, aCollapsibleContenton its first mount isopenorclosedlike any other. - JavaScript reads of a Reka UI part follow the same mapping as the selectors (
el.dataset.state === 'active'on a tab becomes'checked'). Update test assertions and re-record snapshots that contain the old values. - Leave alone:
data-orientation,data-side,data-align,data-disabled,data-highlighted,data-selected,data-active(that one is the roving-focus tab stop, unrelated todata-state), and every value that is alreadyopen/closed/checked/unchecked/indeterminate.
Verify. After the rewrite, a search for data-[state= and [data-state must show no on, off, visible, hidden, expanded, collapsed, delayed-open or instant-open, and active / inactive only on Splitter resize-handle selectors (inactive) or on selectors you deliberately left for the developer to decide. Presence-only [data-state] selectors must be gone.
2. Change events carry details
What changed. update:* events on stateful roots now receive a second argument, a ChangeEventDetails object with reason, event, isCanceled and cancel(), and a cancellable beforeUpdate:* event fires before every change. v-model keeps working unchanged. Uncontrolled components emit synchronously from the interaction instead of from a watcher on the next tick, and a component that mounts uncontrolled and later receives a defined model value becomes controlled from then on, even if the model is later cleared to undefined.
Converted so far: SwitchRoot, TabsRoot, Toggle, ToggleGroupRoot, CheckboxRoot, CheckboxGroupRoot, RadioGroupRoot, ListboxRoot, AccordionRoot (modelValue), DropdownMenuRoot, DropdownMenuSub, ContextMenuRoot, ContextMenuSub, MenubarRoot (modelValue), MenubarSub, DialogRoot, AlertDialogRoot, PopoverRoot, TooltipRoot, HoverCardRoot, CollapsibleRoot, DateFieldRoot, TimeFieldRoot, DateRangeFieldRoot and TimeRangeFieldRoot (modelValue, placeholder; section 20), DatePickerRoot and DateRangePickerRoot (modelValue, placeholder, open, view, and startValue on DateRangePickerRoot; section 20), CalendarRoot and RangeCalendarRoot (modelValue, placeholder, view), ColorAreaRoot, ColorFieldRoot, ColorSliderRoot and ColorSwatchPickerRoot (modelValue), ComboboxRoot and AutocompleteRoot (modelValue, open; section 16), NumberFieldRoot, PinInputRoot, RatingRoot, SliderRoot, TagsInputRoot, TagGroupRoot and EditableRoot (modelValue; sections 17 and 18), SelectRoot (modelValue, open; section 19), TreeRoot (modelValue, expanded; section 21), PaginationRoot (page), StepperRoot (modelValue), ToolbarToggleGroup (through the ToggleGroupRoot it wraps), NavigationMenuRoot and NavigationMenuSub (modelValue; section 23), ToastRoot (open; section 23), SplitterGroup (layout; section 22), DrawerRoot (open, snapPoint; section 28), and the CheckboxItem and RadioGroup parts of DropdownMenu, ContextMenu and Menubar (modelValue; section 29). ProgressRoot has no change model and keeps its single-argument correction events (section 22). On the converted families an update:* event fires only when the value actually changes; re-selecting the current value emits nothing, and a multiple selection is compared entry by entry (a ListboxRoot with multiple and selection-behavior="replace" no longer emits a fresh [value] array for a re-pressed item). ColorAreaRoot also now emits change (declared but never fired in v2) on every pointer move and arrow-key step that changes the color, and changeEnd after each keyboard step as well as on pointer release; both carry a Color object (section 10). Section 29 lists the parts that keep a single-argument update:* on purpose; treat those as unchanged. DrawerRoot is on this contract too; its rewrite rules are in section 28.
How to find it. Search for listeners and emit declarations on those roots: @update:open, @update:model-value, @update:modelValue, @update:placeholder, 'update:open', 'update:modelValue', 'update:placeholder', onUpdate:open, onUpdate:modelValue, onUpdate:placeholder, defineEmits in components that wrap one of the roots, useForwardPropsEmits, emitted('update:open') and toHaveBeenCalledWith in tests, and watch( calls that react to these models.
Rewrite rules.
A listener that only reads the first argument keeps working. Leave it unchanged.
A wrapper component that re-declares the emit type needs the new tuple shape, importing the details type and the family's reason union from
reka-ui:tstype Emits = { 'update:open': [value: boolean] 'update:open': [value: boolean, details: ChangeEventDetails<DialogOpenChangeReason>] }The reason unions, all exported from
reka-ui, areDialogOpenChangeReason(also exported asAlertDialogOpenChangeReason),PopoverOpenChangeReason,TooltipOpenChangeReason,HoverCardOpenChangeReason,MenuOpenChangeReason(shared by the DropdownMenu, ContextMenu and Menubar parts, and also exported asDropdownMenuOpenChangeReason,ContextMenuOpenChangeReasonandMenubarChangeReason),SwitchChangeReason,TabsChangeReason,ToggleChangeReason,ToggleGroupChangeReason,CheckboxChangeReason,CheckboxGroupChangeReason,RadioGroupChangeReason,ListboxChangeReason,AccordionChangeReason,CollapsibleChangeReason,DatePickerOpenChangeReason,DateRangePickerOpenChangeReason,CalendarChangeReason,RangeCalendarChangeReason,ColorAreaChangeReason,ColorFieldChangeReason,ColorSliderChangeReason,ColorSwatchPickerChangeReason,ComboboxChangeReason,ComboboxOpenChangeReason(theopenreasons of bothComboboxRootandAutocompleteRoot),AutocompleteChangeReason,NumberFieldChangeReason,PinInputChangeReason,RatingChangeReason,SliderChangeReason,TagsInputChangeReason,TagGroupChangeReason,EditableChangeReason,SelectChangeReason,SelectOpenChangeReason,TreeChangeReason,TreeExpandedChangeReason,PaginationChangeReason,StepperChangeReason,DateFieldChangeReason,TimeFieldChangeReason,DateRangeFieldChangeReasonandTimeRangeFieldChangeReason(one union:'segment-input' | 'segment-increment' | 'segment-decrement' | 'segment-clear' | 'step-snap'),DatePickerChangeReason(DateFieldChangeReason | CalendarChangeReason) andDateRangePickerChangeReason(DateRangeFieldChangeReason | RangeCalendarChangeReason),SplitterLayoutChangeReason,NavigationMenuChangeReason,ToastOpenChangeReason, andMenuCheckboxItemChangeReasonandMenuRadioGroupChangeReason(both'item-press', for the menu checkbox items and radio groups).ToolbarToggleGroupreportsToggleGroupChangeReason.details.reasonis the family union plus the sharedBaseChangeReason('imperative-action'for programmatic changes such as a slot'sclose()), so aswitchover the family union alone is incomplete.Wrappers that forward with
useForwardPropsEmitsneed no change.Custom parts built on
injectAccordionRootContext()orinjectCollapsibleRootContext(): the Accordion root context'smodelValueis now a readonlyComputedRef, so callchangeModelValueinstead of assigning it, andchangeModelValue(value, reason?, event?)now takes an optional reason and native event and returns a boolean (falsewhen the change was cancelled or did not change the value). On the Collapsible root context,onOpenToggle(event?)accepts the native event,onContentFound(event)is new, andcontentIdis backed by a ref, so assigning it also updates the trigger'saria-controls.Tests: an assertion such as
expect(emit).toHaveBeenCalledWith(true)orexpect(wrapper.emitted('update:open')[0]).toEqual([true])now fails because of the extra argument. Assert on the first element ([0][0]) or useexpect.objectContaining({ reason: '…' })for the details. Tests that awaited a tick for an uncontrolled emit may now see it synchronously; remove waits only if the test's intent is unchanged.A
watchon the model that relied on the old next-tick emit ordering may observe the change one tick earlier. Only change such code if a test or the developer confirms the ordering mattered.Do not add
beforeUpdate:*handlers on your own; they are an opportunity (cancel a close while a form is dirty, for example), not a migration requirement.
Verify. The project's type-check must pass. Every test that asserts on an update:* payload of a converted family must pass.
3. ESM only
What changed. v3 ships ES modules only. The CommonJS build and the require export conditions are gone, for reka-ui and for its reka-ui/nuxt, reka-ui/resolver, reka-ui/namespaced, reka-ui/date, reka-ui/constant and reka-ui/internal entries.
How to find it. Search for require('reka-ui and require("reka-ui, and check the test runner and any Node scripts that load the package.
Rewrite rules. Replace require() with import (or dynamic import() inside CommonJS files). Vite, Nuxt and Vitest need nothing else. Jest projects need ESM support for the package: either run Jest in ESM mode or add reka-ui to transformIgnorePatterns exceptions so it is transformed. If the project's own package is CommonJS and cannot move to ESM, ask before restructuring it.
Verify. The build and the test runner start without a "Cannot use import statement" or "require() of ES Module" error.
4. Generated ids
What changed. The ids Reka UI generates for overlay parts (Dialog and AlertDialog content, title and description; Drawer content, title and description; Popover trigger and content; DropdownMenu trigger and content; the Tooltip label the trigger's aria-describedby points at) are now derived from the root, so their shape differs from v2 (for example reka-tooltip-<n>-content instead of reka-tooltip-content-<n>). A MenubarMenu now allocates its content id when the menu is set up, not when its content first renders, so the numbering of the other generated ids in a page can shift.
How to find it. Search for reka-dialog-, reka-alert-dialog-, reka-drawer-, reka-popover-, reka-dropdown-menu-, reka-menubar-content-, reka-tooltip- and for aria-describedby / aria-labelledby / aria-controls values in tests and selectors.
Rewrite rules. Never depend on the shape of a generated id. In tests, select by role, label or text (getByRole('dialog'), getByRole('tooltip')) or compare the attribute to the id read from the other element. In CSS, style by data attribute or class, not by generated id. Code that passes its own id to a part is unaffected, except that the paired attribute now follows it: the trigger and content of Collapsible, Accordion, Popover and Tabs, and the trigger, content, title and description of Dialog, AlertDialog and Drawer, take an id prop that aria-controls / aria-labelledby / aria-describedby point at (in Tabs, per value). CollapsibleContent and AccordionContent used to drop a passed id; they now render it. Remove code that copied a custom id into those attributes by hand.
5. Disabled triggers rendered asChild
What changed. A disabled Toggle, ToggleGroupItem or CheckboxRoot ignores a user click even when it renders asChild onto an element without native disabled behaviour (a div, a link, a custom component). In v2 only the native disabled attribute blocked the click, so those elements still toggled.
How to find it. Search for Toggle, ToggleGroupItem and CheckboxRoot used with both as-child (or asChild) and disabled (or :disabled), where the child is not a <button>.
Rewrite rules. Nothing to rewrite in most projects: the new behaviour is what a disabled control should do. If a test or handler expects the disabled control to toggle on click, ask before changing it; do not remove disabled on your own.
Verify. Tests that click a disabled asChild control assert that the value did not change.
6. Calendar views replace the month and year pickers
What changed. The MonthPicker, MonthRangePicker, YearPicker and YearRangePicker families no longer exist. CalendarRoot and RangeCalendarRoot take a granularity (day | month | year) that sets what a selection commits, so a month picker is a Calendar with granularity="month". The cell parts of Calendar, RangeCalendar, DatePicker and DateRangePicker take one value prop instead of date / day + month, and the grid part takes the page it renders.
| v2 | v3 |
|---|---|
MonthPickerRoot | CalendarRoot with granularity="month" |
YearPickerRoot | CalendarRoot with granularity="year" |
MonthRangePickerRoot | RangeCalendarRoot with granularity="month" |
YearRangePickerRoot | RangeCalendarRoot with granularity="year" |
MonthPicker<Part>, YearPicker<Part> (Cell, CellTrigger, Grid, GridBody, GridRow, Header, Heading, Next, Prev) | Calendar<Part> |
MonthRangePicker<Part>, YearRangePicker<Part> | RangeCalendar<Part> |
MonthPicker<Part>Props, YearPickerRootEmits and the other exported types | the Calendar<Part>… / RangeCalendar<Part>… type of the same part |
MonthPicker.*, MonthRangePicker.*, YearPicker.*, YearRangePicker.* from reka-ui/namespaced | Calendar.*, RangeCalendar.* |
isMonthDisabled, isYearDisabled | isDateDisabled |
isMonthUnavailable, isYearUnavailable | isDateUnavailable |
maximumMonths, maximumYears | maximumLength |
<…Cell :date="x"> | <…Cell :value="x"> |
<…CellTrigger :day="x" :month="page.value"> | <…CellTrigger :value="x">, and :value="page.value" on the enclosing …Grid |
<MonthPickerCellTrigger :month="x">, <YearPickerCellTrigger :year="x"> | <CalendarCellTrigger :value="x"> |
cell trigger slot props dayValue, monthValue, yearValue | cellValue |
How to find it. Search for MonthPicker, MonthRangePicker, YearPicker, YearRangePicker (imports, templates, types, auto-import or resolver configuration), and for every CalendarCell, CalendarCellTrigger, CalendarGrid, RangeCalendarCell, RangeCalendarCellTrigger, RangeCalendarGrid, DatePickerCell, DatePickerCellTrigger, DatePickerGrid, DateRangePickerCell, DateRangePickerCellTrigger and DateRangePickerGrid in templates, including the namespaced forms (Calendar.Cell, …). Also search for maximumMonths, maximum-months, maximumYears, maximum-years, dayValue, monthValue, yearValue, isMonth, isYear, and for data-selected, data-selection-start, data-selection-end, data-highlighted-start and data-highlighted-end in selectors and tests.
Rewrite rules.
Rename the removed families with the table above and add the matching
granularityto the root. Keep every other prop:v-model,v-model:placeholder,minValue,maxValue,yearsPerPage,multiple,fixedDate,allowNonContiguousRangesand the rest have the same names onCalendarRoot/RangeCalendarRoot.The root's
gridslot prop is always an array of pages. The month and year pickers exposed one object, so wrap their grid in a loop and pass the page to the grid part:vue<MonthPickerRoot v-slot="{ grid }"> <!-- [!code --] --> <MonthPickerGrid> <!-- [!code --] --> <MonthPickerGridBody> <!-- [!code --] --> <MonthPickerGridRow v-for="(row, i) in grid.rows" :key="i"> <!-- [!code --] --> <MonthPickerCell v-for="month in row" :key="month.toString()" :date="month"> <!-- [!code --] --> <MonthPickerCellTrigger :month="month" /> <!-- [!code --] --> <CalendarRoot v-slot="{ grid }" granularity="month"> <!-- [!code ++] --> <CalendarGrid v-for="page in grid" :key="page.value.toString()" :value="page.value"> <!-- [!code ++] --> <CalendarGridBody> <!-- [!code ++] --> <CalendarGridRow v-for="(row, i) in page.rows" :key="i"> <!-- [!code ++] --> <CalendarCell v-for="month in row" :key="month.toString()" :value="month"> <!-- [!code ++] --> <CalendarCellTrigger :value="month" /> <!-- [!code ++] -->In existing day calendars, date pickers and date range pickers: replace
:dateon the cell and:dayon the cell trigger with:value, delete:monthfrom the cell trigger, and add:valuewith the same expression that:monthhad (usuallymonth.value) to the enclosing grid part. Do not skip the grid: withoutvalueit cannot mark the days of the neighbouring months asdata-outside-view.A matcher renamed to
isDateDisabledorisDateUnavailablekeeps its body: in a month or year picker it is still called with a date inside the month or year being tested. Matchers are called only for cells at thegranularity, with that unit ('day','month'or'year') as a second argument. The views coarser than the granularity never call them: those cells are disabled only byminValue,maxValueanddisabled. Do not add unit checks to existing matchers.maximumMonthsandmaximumYearsbecomemaximumLength, counted in units of thegranularity.maximumDayson a day range calendar still works as a deprecated alias; rename it tomaximumLengthas well.data-selected,data-selection-start,data-selection-end,data-highlighted-startanddata-highlighted-endare now present with an empty value instead of"true". Presence selectors ([data-selected],data-[selected]:) need no change. Rewrite value selectors and assertions:[data-selected='true']→[data-selected],toHaveAttribute('data-selected', 'true')→toHaveAttribute('data-selected').update:modelValue,update:placeholderandupdate:viewonCalendarRootandRangeCalendarRoot, andupdate:viewonDatePickerRootandDateRangePickerRoot, follow section 2.A
nextPage/prevPagefunction on the root keeps working unchanged. It is used only in thegranularityview, with that view as an extra second argument; the coarser views page by their default step.The new
view,defaultViewandmaxViewprops and theCalendarView/CalendarViewTriggerparts are optional. Do not add them during the migration. If the project built its own month or year switching around a calendar (for example swapping aMonthPickerand aCalendarwithv-if), keep that code working with the renames above, and ask before replacing it with views.A
granularityprop onDatePickerRootorDateRangePickerRootis untouched: on those roots it is still the field's time granularity.
Verify. A search for MonthPicker, MonthRangePicker, YearPicker and YearRangePicker returns nothing in the project's own source. No CalendarCell, RangeCalendarCell, DatePickerCell or DateRangePickerCell has a :date prop, no cell trigger has :day or :month, and every grid part in a day view has :value. The type-check passes. Render one migrated calendar and check that the days of the neighbouring months carry data-outside-view.
7. by comparison functions receive strings
What changed. A function passed as by to ListboxRoot, ComboboxRoot or SelectRoot now runs for every value, strings included. In v2 string values were compared with === and the function was only called for objects. by is still read once at setup.
How to find it. Search for :by=" and by: on those roots where the value is a function (not a string key).
Rewrite rules. If the list can contain string values and the function dereferences a property (a.id === b.id), add a string guard (typeof a === 'string' ? a === b : a.id === b.id). A function that already handles both, or a list of objects only, needs no change. A string key (by="id") is unaffected.
Verify. Selection and highlighting of string options in those lists behave as before.
8. Listbox keyboard handling
What changed. ListboxContent, ListboxFilter, ComboboxInput and AutocompleteInput resolve every keydown through one navigation intent.
- PageUp and PageDown now move the highlight to the first or last item and prevent the default, both in the content and in the filter input. In v2 they scrolled the container natively.
- While a filter has focus, ArrowLeft and ArrowRight always stay with the text input, even in a
horizontallistbox. ArrowUp, ArrowDown, Home and End still navigate from the filter.ListboxContentno longer prevents the default of arrow keys while a filter owns the keyboard. - Typeahead no longer receives navigation keys.
- New and additive:
getNavigationIntentonListboxRootreturns'first' | 'last' | 'prev' | 'next' | 'select',null(opt the key out, Enter's selection included) orundefined(default mapping). The filter never passes it unmodified printable keys, and a'select'intent for Space on a focused item does not select twice.ComboboxRootandAutocompleteRootaccept it too; there a'next'/'prev'intent also opens a closed popup.textValueonListboxItemsets the label-registry text and defaults to the text content. ListboxRoot'supdate:modelValueandbeforeUpdate:modelValueare typedT | T[] | undefined(type-only).
How to find it.
- Keydown listeners next to these parts that handle PageUp/PageDown themselves: search for
PageUp,PageDown,'Pagein components that renderListboxContent,ListboxFilter,ComboboxInputorAutocompleteInput. - Code that re-implemented custom navigation keys:
@keydownonListboxRoot,ListboxContentorListboxFilterthat callshighlightItem,highlightFirstItemor moves focus between options, andkey === 'n'/key === 'p'checks withctrlKey. - Tests that press arrow keys in a listbox filter and assert
defaultPrevented, or that rely on PageUp/PageDown scrolling: search*.test.*and*.spec.*forPageUp,PageDownanddefaultPreventednearListboxFilter/ComboboxInput. - Handlers typed for one value on
@update:model-valueofListboxRoot((value: string) =>).
Rewrite rules.
- A custom PageUp/PageDown handler on these parts that only jumped to the first/last item: remove it. If the app needs the native scroll, pass
:get-navigation-intent="e => (e.key === 'PageUp' || e.key === 'PageDown') ? null : undefined"onListboxRoot. - A
@keydownhandler that maps extra keys to moves (Ctrl+N/P, vim keys): replace it withgetNavigationIntentonListboxRoot,ComboboxRootorAutocompleteRootreturning the intent; returnundefinedfor every other key. - An item whose visible content is not plain text and that is shown elsewhere by label: add
text-value="…". Otherwise no change. - A
ListboxRootmodel handler typed for a single value: widen it toT | T[] | undefined, or narrow inside (Array.isArray(v)). Do not change runtime logic. - Tests: update an expectation that ArrowLeft/ArrowRight in a horizontal filter is prevented, or that PageUp/PageDown is not. Ask the developer before changing any other keyboard assertion.
Verify. In each affected listbox: PageUp/PageDown move to the first/last option; ArrowLeft/ArrowRight move the caret in a filter; typing letters in a filter still filters; Enter still selects unless getNavigationIntent returns null for it. Run the type-check for the handler retyping.
9. Listbox filtering (no rewrite)
What changed. Nothing for existing code. ListboxRoot gained an opt-in filter prop: with :filter="contains" (from useFilter), the items whose text does not match the ListboxFilter value are not rendered, and keyboard navigation, typeahead and select-all skip them. Without filter (or with null) the listbox filters nothing, exactly as in v2. ComboboxRoot and AutocompleteRoot now filter through the same mechanism by default (section 16).
Rewrite rules. Do not add filter to an existing listbox: one whose items are already filtered by hand keeps working unchanged. Mention listboxes that compute a filtered item list from the ListboxFilter value in the report as optional candidates; switching one over means passing filter and rendering the full list.
10. Color values are Color objects
What changed. ColorAreaRoot, ColorFieldRoot and ColorSliderRoot emit a Color object ({ space: 'hsl', h, s, l, alpha }, { space: 'hsb', h, s, b, alpha } or { space: 'rgb', r, g, b, alpha }) instead of a hex string.
update:modelValue,beforeUpdate:modelValue,changeandchangeEndcarry aColor;update:colorcarries the sameColor.modelValueanddefaultValuestill accept strings, so av-modelref that starts as a hex string holds aColorafter the first change.- New
update:hexevent (onHexUpdateonuseColorArea,useColorField,useColorSlider): the lossy hex string after each change. The hidden form input still submits hex. - Updates fire only for a structurally different color (
isEqualColor, now exported). The v2 repeat of an unchanged hex string onColorAreaRootandColorSliderRootis gone. ColorFieldRootnow emitschangeandchangeEndafter each committed change. On every componentchangeEndfires only when the interaction changed the color and the model holds it: a drag back to its start or an update a controlled parent rejects reports nothing, and with a controlledmodelValueit fires after the parent re-renders.ColorAreaRoothas adirprop and inherits theConfigProviderdirection (mirrored x axis, arrow keys, thumb and gradient underrtl).ColorSwatchPickerRoot/ColorSwatchPickerItemacceptstring | Colorand compare values structurally; they still emit the item value as declared.injectColorAreaRootContext()/injectColorSliderRootContext()/injectColorFieldRootContext():color,xValueandyValueare read-only computeds.- Utilities:
convertToHsl/convertToHsbkeep the hue between HSL and HSB. The channel and gradient helpers are no longer exported (section 12). ColorSliderTrack's gradient follows the slider: bottom to top whenorientation="vertical"(top to bottom when alsoinverted); on a horizontal slider, right to left when exactly one ofinvertedand right-to-left (also inherited fromConfigProvider) is set. In v2 it always ran left to right.ColorFieldInputvalidates on commit: when Enter or blur rejects text that does not parse, the text reverts to the current color as before, and the input getsaria-invalid="true"and the input andColorFieldRootgetdata-invalid. They stay until an edit parses or a later change commits. Typing alone never sets them.
How to find it.
- Every
ColorAreaRoot,ColorFieldRootandColorSliderRootusage: search forColorAreaRoot,ColorFieldRoot,ColorSliderRoot,useColorArea,useColorFieldanduseColorSlider. For each, find the variable bound withv-model/:model-valueand every listener on@update:model-value,@before-update:model-value,@change,@change-end,onChange,onChangeEnd,onUpdateandonBeforeUpdate. - Uses of those variables as strings: template interpolation (
), style bindings (background: color), string methods (.startsWith,.toUpperCase,.slice), comparisons with string literals,JSON/API payloads, and TypeScript types (ref<string>,(value: string) =>). - Workarounds for the v2 repeat: listeners that compared the new hex with the previous one before acting.
ColorSwatchPickerRootmodels that are compared with===against a color from another color component.injectColorAreaRootContext/injectColorSliderRootContext/injectColorFieldRootContextin custom parts that assignxValue.value,yValue.valueorcolor.value.
Rewrite rules.
- A
v-modelvariable that is only passed between color components (or intoColorSwatch, which acceptsColor): widen its type tostring | Color(importtype Colorfromreka-ui) and change nothing else. - A variable also used as a string: keep the
v-modeland addconst hex = computed(() => colorToHex(normalizeColor(color.value)))(importcolorToHex,normalizeColorfromreka-ui); replace the string uses withhex. - A variable that must stay a hex string (persisted, sent to an API, typed
stringacross module boundaries): replacev-model="x"with:model-value="x" @update:hex="x = $event". Ask the developer first if the component edits hue or saturation, because a hex round trip loses the hue of greys.update:hexcan repeat the same string (moves finer than one 8-bit step still emit), so a handler with side effects must compare against the previous string. - Listeners typed
(value: string)onupdate:model-value,before-update:model-value,changeorchange-end: retype to(value: Color)and format withcolorToHex(value)where a string was used. - Remove hex-equality guards that only existed to skip the v2 repeated emit; use
isEqualColor(a, b)where a guard is still needed. ColorSwatchPickerRootcomparisons with===: useisEqualColor.- A custom part that wrote
xValue/yValue/coloron a color context: callupdateValues(x, y)on the ColorArea context instead; ask for the other contexts. - An app wrapped in
ConfigProviderwithdir="rtl"that wants a left-to-right color area: adddir="ltr"toColorAreaRoot. Otherwise no change. - Tests that assert a hex string from these events: assert
colorToHex(payload)or theColorobject instead.
Verify. The type-check passes. In each migrated picker, drag the area and the sliders and type into the fields: the shared color stays in sync, any hex label updates, and a grey keeps its hue when the hue slider moves. A form containing a color component still submits a hex string.
11. ColorArea renders one range input per channel
What changed. ColorAreaThumb renders two visually hidden <input type="range"> elements after its slot content, one per channel. Each is named after its channel (aria-label="Saturation"), has its own value, min, max and aria-orientation (horizontal for x, vertical for y), and aria-valuetext like "50, Lightness 40". Focus goes to these inputs, not the thumb; one is in the tab order, and an arrow key moves focus to the input of the axis it changes. The thumb lost role="slider", tabindex and every aria-* attribute; ColorAreaArea lost role="application", aria-roledescription and aria-disabled (ColorAreaRoot keeps aria-disabled; data-disabled is unchanged). useColorArea() returns new xInput / yInput surfaces and setInputElement(axis, el). With <ColorAreaThumb as-child> the inputs render next to the child element, placed at the thumb's position. Enter on an input does not submit an enclosing form. Pointer, keyboard and RTL behaviour are unchanged.
How to find it.
- Styles on
ColorAreaThumborColorAreaAreathat use:focus,:focus-visible,focus:orfocus-visible:. - Tests and selectors that use
role="slider"/getByRole('slider')/[role=slider]orrole="application"/[role=application]nearColorArea, or that readaria-valuenow/aria-valuetextfrom the thumb. - Direct
useColorArea()usage that rendersthumb.attrs(search foruseColorArea).
Rewrite rules.
- Focus styles on the thumb or the area:
:focus→:focus-within,focus:→focus-within:. Use:has(:focus-visible)(Tailwindhas-[:focus-visible]:) for keyboard-only rings. With<ColorAreaThumb as-child>the inputs render next to the child element, not inside it, so put the focus style onColorAreaAreainstead. - Test selectors:
getByRole('slider')→getByRole('slider', { name: '<x channel name>' })(or the y channel name);[role=slider]→input[type=range][aria-orientation=horizontal](x) or[aria-orientation=vertical](y). Read values from the input'svalueinstead ofaria-valuenow, and the y value from the y input instead of parsing the thumb'saria-valuetext. Keydown and focus assertions target the input. [role=application]used to reach the area: select theColorAreaAreaelement by class or test id.- Direct
useColorArea(): inside the thumb element, render<input :ref="el => setInputElement('x', el)" v-bind="xInput.attrs.value">and the same for'y'withyInput. KeepsetThumbElementonly if the thumb must still receive focus when no input is rendered.
Verify. Tab reaches the area once and arrow keys still move the thumb; a screen reader announces the channel name and value. Tests that select the thumb by role pass with the rewritten selectors.
12. Color utilities removed from the package root
What changed. The package root keeps parseColor, normalizeColor, isValidColor, isEqualColor, colorToHex, colorToString, convertToRgb, convertToHsl, convertToHsb and the types Color, RGBColor, HSLColor, HSBColor, ColorSpace, ColorChannel, ColorFormat. These exports are removed:
| Removed | Replacement |
|---|---|
colorToRgb(c), colorToHsl(c), colorToHsb(c) | colorToString(c, 'rgb'), colorToString(c, 'hsl'), colorToString(c, 'hsb') |
getChannelValue(c, ch) | the property of the converted color: hue → convertToHsl(c).h, saturation → convertToHsl(c).s (or convertToHsb(c).s in HSB), lightness → convertToHsl(c).l, brightness → convertToHsb(c).b, red/green/blue → convertToRgb(c).r/.g/.b, alpha → c.alpha * 100 |
setChannelValue(c, ch, v), setChannelValues(c, list) | a spread of the converted color, e.g. { ...convertToHsl(c), h: v }; alpha is { ...c, alpha: v / 100 } |
getChannelRange(ch) | constants: hue { min: 0, max: 360, step: 1 }; saturation, lightness, brightness, alpha { min: 0, max: 100, step: 1 }; red, green, blue { min: 0, max: 255, step: 1 } |
getChannelName(ch) | the project's own label (capitalized English names: 'Hue', 'Saturation', …) |
getAreaBackgroundStyle, getAreaGradient | the style slot prop of ColorAreaRoot bound to ColorAreaArea |
getSliderBackgroundStyle, getSliderGradient | ColorSliderTrack (it sets the gradient itself) |
How to find it. Search imports from reka-ui for colorToRgb, colorToHsl, colorToHsb, getChannelValue, setChannelValue, setChannelValues, getChannelRange, getChannelName, getAreaBackgroundStyle, getAreaGradient, getSliderBackgroundStyle and getSliderGradient.
Rewrite rules. Apply the table. For a gradient helper used outside a Color component (a custom track or preview), ask before replacing it with hand-written CSS. Do not import from reka-ui/internal or deep paths to get the removed helpers back.
Verify. The search above returns nothing, and the type-check passes.
13. Template refs on parts
What changed. A template ref on a part exposes element and $el (both read one reactive ref to the part's DOM element) plus the methods in that part's API reference, and nothing else.
partRef.value.$elandpartRef.value.elementreturn the element.$elis now reactive. No rewrite.- When the part renders no element (for example a closed
DialogContent),elementisnulland$elfalls back to Vue's placeholder comment node, as in v2. No rewrite. - Prop values are no longer readable from a part ref:
partRef.value.<prop>isundefined. Development builds warn once per part and prop, with a message that starts with[reka-ui] <PartName>: reading the prop. - Methods of a component rendered through a part's
as/asChildare no longer reachable on the part's ref. useForwardExposeis deprecated and logs a one-time warning in development;useForwardElementreplaces it.
How to find it.
- Template refs on Reka UI parts:
ref="x"/:ref/useTemplateRef('x')/ref<InstanceType<typeof SomePart>>()on any component imported fromreka-ui. For each ref variable, list every property read offx.value. - Run the app or the tests in development and collect the
reading the propwarnings. useForwardExposeimports.- Components passed as the child of an
as-childpart (or as theasvalue) that have more than one root node, av-ifon the root, or that render a fragment.
Rewrite rules.
- Reads of
$el,elementor a method documented in the part's API reference: leave unchanged. - A read of a prop (
x.value.disabled,x.value.modelValue,x.value.open, …): replace it with the value the component passes to that prop (the bound variable or literal). If the prop is not bound by the component, use the prop's documented default. Ask if the value comes from somewhere you cannot trace. - A call to a method that the part does not document, where the method belongs to a component rendered through the part's
as/asChild: add a template ref to that inner component and call the method on it. const { forwardRef, ... } = useForwardExpose(): replace withconst { forwardRef, ..., expose } = useForwardElement()followed bydefineExpose(expose). If the component already callsdefineExpose({ ... }), change it todefineExpose(mergeExpose(expose, { ... })), with theuseForwardElement()call placed above it. A bareuseForwardExpose()call withoutforwardRef: replace it the same way and add:ref="forwardRef"to the template's root element. ImportuseForwardElement/mergeExposefromreka-ui.- A component used as an
as-childchild with several root nodes, a rootv-if, or a fragment root: addconst { forwardRef, expose } = useForwardElement()anddefineExpose(expose), bind:ref="forwardRef"on the element the part should target, and if it has several root nodes adddefineOptions({ inheritAttrs: false })withv-bind="$attrs"on that element. Leave single-root children unchanged.
Verify. The type-check passes. No reading the prop warnings remain in development. Every $el / element read from a part ref still returns the expected element.
14. Modal layers no longer touch <body>
What changed.
- Modal layers (modal
Dialog,AlertDialog,Drawer,Popover,DropdownMenu,ContextMenu, an openSelect, any content withdisableOutsidePointerEvents) no longer setpointer-events: noneon<body>. Each renders a transparentposition: fixed<div data-reka-internal-backdrop role="presentation">right below itself instead, with thez-indexof the layer (or of its positioning wrapper / fixed container). A press on it closes the layer. Page content with a lowerz-index(a sticky header) is covered; only elements in the root stacking context with a higherz-indexthan the layer stay clickable. A non-portaled layer inside atransform/filter/contain: paint/will-change: transform/backdrop-filterancestor gets its backdrop in<body>, with a hole over the layer. - A modal
Dialog/Drawercloses only on a press on its internal backdrop, itsDialogOverlay/DrawerOverlay, or a container around its content, not on a press on an element stacked above the backdrop. - A modal
Popover/DropdownMenutrigger, theContextMenutrigger area and theComboboxinput are cut out of the backdrop and stay interactive. - The scroll lock hides the overflow of the page's scroll container and keeps the gutter with
scrollbar-gutter: stable(or pins<body>'s size and setsdata-reka-scroll-lockedon<html>where that is unsupported). It no longer setspadding-right/margin-righton<body>or--scrollbar-widthon<html>, no longer interceptstouchmoveon iOS, and applies a macrotask after the overlay opens. - A modal
Dialog/AlertDialog/Drawerlocks scroll whenever it is open, with or without its overlay part. In v2 only the overlay part locked it. ADrawerwithmodal="trap-focus"no longer locks scroll. modaldefaults are unchanged.
How to find it.
pointerEvents/pointer-eventstogether withdocument.bodyorbody.stylein tests, styles and scripts.--scrollbar-widthin CSS, SCSS, Tailwind arbitrary values ([--scrollbar-width],var(--scrollbar-width)) and inline styles.body.style.overflow,body.style.paddingRight,body.style.marginRightin tests.scrollBodyonConfigProvider.- Modal
DialogRoot/AlertDialogRoot/DrawerRootusages that render noDialogOverlay/AlertDialogOverlay/DrawerOverlay. - Tests that dismiss a modal dialog by firing
pointerdown/ clicking on an element other than the overlay ordocument.body.
Rewrite rules.
- An assertion that
document.body.style.pointerEventsis'none'while a layer is open: assertdocument.querySelector('[data-reka-internal-backdrop]')is notnull. An assertion that it is restored after close: assert the backdrop isnull. Remove code that resetsdocument.body.style.pointerEventsbetween tests. - Code that sets
pointer-events: autoon<body>or on a third-party element to keep it clickable next to a reka overlay: remove it. var(--scrollbar-width)used to offset fixed elements while an overlay is open: remove the declaration. Ask if the variable is used for anything else.- Test assertions on
document.body.style.overflow === 'hidden': replace withgetComputedStyle(document.body).overflowY === 'hidden', waited for withvi.waitFor(or the test framework's equivalent). Assertions onpaddingRight/marginRightof<body>: remove, unlessConfigProvidersetsscrollBodyto an object. - A test that dismisses a modal
Dialog/Drawerby pressing an arbitrary outside element: press the overlay,[data-reka-internal-backdrop]ordocument.bodyinstead. Playwright / Vitest browser clicks on an element under a modal layer needforce: true. - A modal
Dialog/AlertDialog/Drawerwith no overlay part: leave it unchanged, and ask whether the page should stay scrollable while it is open. If yes, set:modal="false"(ormodal="trap-focus"on aDrawer). scrollBodyonConfigProvider: leave unchanged.- Page chrome (a sticky header, a sidebar) whose
z-indexis higher than the overlay content's and that should be blocked by modal layers: addisolation: isolateto the app root element (Base UI's recommendation) when the overlays are portaled to<body>. Ask before lowering anyz-index.
Verify. Open each modal layer: the page does not scroll, does not shift horizontally, and <body> has no pointer-events inline style. Close it: <html> and <body> inline styles are back to what they were. The search for --scrollbar-width returns nothing.
15. Menu wrapper contexts
What changed. These changes affect only custom parts and tests built on the menu wrappers' injected contexts. Code that uses the components and v-model is not affected.
- The
MenubarRootcontext (injectMenubarRootContext()) exposesmodelValueas a readonly ref, so assigningmodelValue.valueno longer opens or closes a menu.onMenuOpen(value, reason?, event?),onMenuClose(reason?, event?)andonMenuToggle(value, reason?, event?)accept an optional reason and native event, and return a boolean (falsewhen the change was cancelled or did not change the value). MenubarRoot'supdate:modelValueis typed[value: string, details]. v2 declared it as[value: boolean], although the payload was always the open menu's string value (''when every menu is closed).DropdownMenuRoot,ContextMenuRootandMenubarMenuno longer render an innerMenuRootcomponent. They provide the Menu contexts themselves, so a component lookup forMenuRootunder them finds nothing.- The
DropdownMenuRootcontext setstriggerIdandcontentIdup front. A custom trigger or content that filled them in (rootContext.triggerId ||= …) now keeps the root's ids.
How to find it.
injectMenubarRootContext, and assignments to.modelValue.valueon its result.'update:modelValue'in emit types of components that wrapMenubarRoot.findComponent(MenuRoot)/findAllComponents(MenuRoot)in tests.injectDropdownMenuRootContextfollowed by an assignment totriggerIdorcontentId.
Rewrite rules.
ctx.modelValue.value = value: replace withctx.onMenuOpen(value).ctx.modelValue.value = '': replace withctx.onMenuClose().- A wrapper emit type
'update:modelValue': [value: boolean]for a menubar: change it to[value: string, details: ChangeEventDetails<MenubarChangeReason>], importing both types fromreka-ui. - A test that finds
MenuRoot: find the wrapper root (DropdownMenuRoot,ContextMenuRoot,MenubarMenu) instead and assert on its emits. For aMenubarMenu, assert on theMenubarRootupdate:modelValue. - An assignment to
triggerId/contentIdon the dropdown context: remove it. If the custom part needs a specific id, passidto the part instead, and ask if other code reads the old id.
Verify. The type-check passes, and the menubar and dropdown tests pass.
16. Combobox and Autocomplete
What changed.
- Filtering moved onto the shared Listbox filter.
filteronComboboxRoot/AutocompleteRoottakes(text, search, value) => booleanornull; omitted, items match withuseFilter'scontains(v2 behavior).ignoreFilteris a deprecated alias for:filter="null". - A
ComboboxVirtualizer/AutocompleteVirtualizernow filters itsoptionswith the root's filter, matchingtextContent(option)or the option's string form. In v2 filtering was off in a virtualized combobox. - A filtered-out item stays mounted and renders nothing (v2 unmounted it).
- The root ref's
filteredis{ search, active, count }(v2:{ count, items, groups }). - No nested
ListboxRootcomponent and noListboxFilterinside the input. One object is provided as both the Combobox and the Listbox root context. Removed from the Combobox root context:allItems,allGroups,ignoreFilter. Changed:filterStateshape,onOpenChange(value, reason?, event?)returns a boolean,highlightedElementisnullwhen empty. New:setModelValue,selectItem,pressItem,clearModelValue,filter,baseId. The Autocomplete root context'smodelValueis read-only;onModelValueChange(value, reason?, event?)writes it. - Content ids are
<root id>-content(reka-combobox-v-0-content,reka-autocomplete-v-0-content; v2reka-combobox-content-v-1), andaria-controlsis set from the first render. update:modelValueis typedT[]whenmultipleis set andT | nullotherwise (type-only; a clear emitsnull).beforeUpdate:modelValueandbeforeUpdate:openare new (section 2).modelValueanddefaultValueonComboboxRootare typedT | T[] | null(v2T | T[]), so the emittednullbinds back throughv-model. Type-only and widening: no rewrite needed.- New and additive:
displayValueon both roots,getNavigationIntenton both roots (section 8),useComboboxRoot().
How to find it.
ignore-filter,:ignore-filter,ignoreFilteronComboboxRoot/AutocompleteRoot.ComboboxVirtualizer/AutocompleteVirtualizerusages. For each, note whether itsoptionsare computed from the input text (acomputedthat filters on theComboboxInputv-model) and whether it passestext-content..filteredread off aComboboxRoot/AutocompleteRoottemplate ref.injectComboboxRootContext(/injectAutocompleteRootContext(in custom parts; within them,allItems,allGroups,ignoreFilter,filterState,awaitononOpenChange, writes tomodelValue.value.reka-combobox-contentin selectors, snapshots and tests;findComponent(ListboxRoot)/findComponent(ListboxFilter)in combobox tests.- Handlers on
@update:model-valueof amultiplecombobox typed for a single value.
Rewrite rules.
ignore-filter/:ignore-filter="true": replace with:filter="null".:ignore-filter="flag": replace with:filter="flag ? null : undefined".- A virtualized combobox whose
optionsare filtered by hand from the input text: add:filter="null"to its root (keeps the v2 behavior exactly). Do not remove the hand-written filtering unless the developer asks. - A virtualized combobox whose
optionsare NOT filtered by hand: it now filters. If the options are objects and there is notext-content, add:text-contentreturning the option's label. Ask if no label property is obvious. rootRef.value.filtered.count: leave unchanged. Reads offiltered.itemsorfiltered.groups: ask; there is no per-item equivalent.- Custom parts: replace
allItems.value.sizewithfilterState.value.count,ignoreFilter.valuewithfilter.value === null, and dropawaitbeforeonOpenChange(...). Writes tomodelValue.valuekeep working; leave them unless a reason is wanted. - Old content ids in selectors or snapshots: select by
role="listbox"or the input'saria-controlsinstead of the literal id; update snapshots. findComponent(ListboxRoot)/findComponent(ListboxFilter)in combobox tests: query the rendered element instead ([role=listbox]'s parent for the root,input[role=combobox]for the input).- A single-value handler on a
multiplecombobox: type it as an array. Do not change runtime logic.
Verify. Typing in each combobox still narrows the options as before, a virtualized combobox shows its options with an empty input and narrows them when typing, the type-check passes, and tests that assert on content ids or inner components pass after the updates above.
17. Form input contexts
What changed. These changes affect only custom parts built on the form-input root contexts. Code that uses the components and v-model is not affected.
- The
PinInputRoot,RatingRoot,TagsInputRoot,TagGroupRootandEditableRootcontexts exposemodelValueas a readonly ref, so assigningmodelValue.valueno longer changes the value. - New context methods:
setModelValue(value, reason?, event?)andupdateModelValueAt(index, value, reason?, event?)on PinInput,onAddValues(texts, reason?, event?)andonClear(reason?, event?)on TagsInput. - Existing methods take an optional trailing reason and native event: Rating
changeModelValue, TagsInputonAddValue/onRemoveValue, TagGrouptoggleSelection/removeTags(and the item context'sremove(event?)), Editablesubmit, and NumberFieldhandleIncrease/handleDecrease/handleMinMaxValue/applyInputValue. RatingchangeModelValue, TagsInputonAddValue/onRemoveValue, TagGrouptoggleSelection, Editablesubmitand NumberFieldapplyInputValuereturnfalsewhen the change was cancelled or did not change the value. TagGroupremoveTags/removeand NumberFieldhandleIncrease/handleDecrease/handleMinMaxValuereturn nothing; do not test their result. - The NumberField context's
modelValuestays writable; an assignment now emitsbeforeUpdate:modelValue/update:modelValuewith reason'imperative-action'.
How to find it.
injectPinInputRootContext(,injectRatingRootContext(,injectTagsInputRootContext(,injectTagGroupRootContext(andinjectEditableRootContext(in custom parts, and assignments to.modelValue.valueon their results.
Rewrite rules.
- PinInput:
ctx.modelValue.value = v→ctx.setModelValue(v). - Rating:
ctx.modelValue.value = v→ctx.changeModelValue(v). - TagsInput:
ctx.modelValue.value = []→ctx.onClear(). Any other assignment: ask. - TagGroup: an assignment that selects or deselects one value →
ctx.toggleSelection(value). Any other assignment: ask. - Editable:
ctx.modelValue.value = x→ctx.inputValue.value = xfollowed byctx.submit(). Ask if the code meant to change the value without leaving edit mode. - Leave NumberField context code unchanged.
Verify. The type-check passes, and the custom parts still change the value.
18. TagsInput, PinInput and Editable events
What changed.
TagsInputRoot:addTagandremoveTagfire afterupdate:modelValue(v2: before it), and not at all whenbeforeUpdate:modelValuecancels the change. Withv-modelthe bound array is already updated when they run. With:model-valueand a handler,update:modelValueis a request: they still fire if the handler does not apply it, and the bound array then stays unchanged.invalidfires for each rejected tag beforebeforeUpdate:modelValue, and also when the change is then cancelled. A paste adds all its tags in oneupdate:modelValue(v2: one emit per tag;invalidandaddTagstill fire per tag).TagsInputRootandPinInputRoot: mutating the bound array in place (push,splice) no longer emitsupdate:modelValue. With:model-valueand no update handler, the tags or digits no longer change locally (v2 kept a local copy). When the parent does not apply a change, TagsInput keeps the typed text and PinInput restores the digit without moving focus.EditableRoot, uncontrolled only: on a submit that changes the value,update:modelValuefires beforeupdate:stateandsubmit(v2: on the next tick, after them). A controlled Editable already used this order. In both modes a cancelled submit stays in edit mode and fires neitherupdate:statenorsubmit, and an unchanged submit emits noupdate:modelValuebut still firesupdate:stateandsubmit.
How to find it.
@add-tag/@remove-tag/onAddTag/onRemoveTaghandlers onTagsInputRootthat read the bound model.TagsInputRootorPinInputRootused with:model-valueand no@update:model-value..push(/.splice(/.length =/ index assignments on an array bound to thev-modelofTagsInputRootorPinInputRoot.- Tests that count
update:modelValueemits after a paste intoTagsInputInput. @submit/@update:statehandlers on anEditableRootwithoutv-model/:model-valuethat read the value.
Rewrite rules.
- An
@add-tag/@remove-taghandler that reads the model: withv-modelit now sees the updated array. With:model-valueand an@update:model-valuehandler that can reject or transform the value, read the tag from the event payload instead of the bound array. If it relied on the old value: ask. :model-valuewithout an update handler onTagsInputRootorPinInputRoot, where the value was expected to change: replace withv-model. If it was meant to be read-only: leave it.- An in-place mutation that relied on
update:modelValuefiring: assign a new array (model.value = [...model.value, tag]). - A test expecting one emit per pasted tag: expect one emit whose payload holds all of them.
- Editable
@submit/@update:statehandlers: the model is already updated when they run. Leave them unchanged unless they compensated for the old order; if they did: ask.
Verify. The type-check passes, and the TagsInput, PinInput and Editable tests pass.
19. Select
What changed.
update:modelValueandupdate:openonSelectRootcarry details, andbeforeUpdate:modelValue/beforeUpdate:openare new (section 2). Reasons:SelectChangeReason('item-press' | 'item-keydown' | 'typeahead' | 'autofill') andSelectOpenChangeReason('trigger-press' | 'list-navigation' | 'item-press' | 'item-keydown' | 'escape-key' | 'outside-press').- Pressing the selected item of a single select closes it without emitting
update:modelValue, also whenbymatches a different object. Mutating an uncontrolled model array in place no longer emits. update:modelValueis typedT[]whenmultipleis set andTotherwise, as in v2 (type-only; a single select never emitsnull).- Typing on a focused, closed
SelectTriggerselects the next matching item (reasontypeahead). In v2 it did nothing.multipleselects are unchanged. - In
popperposition, pressing the trigger of an open select closes it (reasontrigger-press). SelectValuekeeps the text of a selected item after itsSelectItemTextunmounts.- A closed select renders lightweight items (value, text,
disabled) into a detached fragment only while needed (a selected value with noitemslabel; a typed character on the closed trigger, until focus leaves it; a named select in a form, in idle time withitems). Focus alone renders nothing. While rendered they stay live, also in a deactivatedKeepAlivebranch or aTeleport; when nothing needs them they unmount, and the texts stay remembered. A change to your template while they aren't rendered isn't seen until they render again; the remembered texts stay. Items each in their own shadow root keep their texts live, but their order among those roots isn't tracked. When items have no common ancestor below<body>or a shadow root, a moved wrapper around them isn't noticed.SelectPortalrenders nothing until the first open, so a template ref onSelectContentisundefineduntil then. - New
itemsprop onSelectRoot(Base UI shape:Record<value, label>,{ value, label, disabled? }[], or{ label?, items }[]groups). With it, labels come from the data (no closed render for a selected value); rendered items it does not list still count for typeahead and native options. While the items aren't rendered,disabledcomes only fromitems[].disabled: adisabledonly on aSelectItemis unknown, so any typed character thatitemsanswers can select that option, and its native option stays enabled. Set it initemsas well. With partial or differently ordereditems, the typeahead's order can change once the items render. - The hidden native
<select>marks selected options withselectedand no longer receivesvalue. Amultipleselect submits every selected value. Autofill passes the option's own value (objects included). With a record initems, an autofill before the items have rendered passes the string key; use the array shape for non-string values. - Content ids are
<root id>-content(reka-select-v-0-content; v2reka-select-content-v-1). - Root context (
injectSelectRootContext()):modelValueandopenare read-onlyComputedRefs.onValueChange(value, reason?, event?)andonOpenChange(open, reason?, event?)return a boolean.optionsSet,onOptionAddandonOptionRemoveare removed; uselabels.register/labels.get/labels.entries.- New:
baseId,setModelValue,isSelected,pressItem,selectedLabels,displayValue,getNavigationIntent.
- New and additive:
items,displayValueandgetNavigationIntentonSelectRoot,selectedLabelson theSelectValueslot, anduseSelectRoot()with the part composables.
How to find it.
injectSelectRootContext(in custom parts; within them, assignments tomodelValue.valueoropen.value, andoptionsSet,onOptionAdd,onOptionRemove.reka-select-contentin selectors, snapshots and tests.@update:model-valuehandlers on aSelectRootwithmultiple, and.push(/.splice(on a select'sv-modelarray.- Tests that assert
update:modelValuewas emitted after pressing the already-selected item. - Template refs on
SelectContentread before the first open, and tests that query a closed select's items ([role=option]) in the DOM.
Rewrite rules.
rootContext.modelValue.value = x: replace withrootContext.setModelValue(x).rootContext.open.value = x: replace withrootContext.onOpenChange(x).rootContext.optionsSet.valuereads: replace withrootContext.labels.entries()(entries are{ value, label, disabled }; v2 usedtextContentforlabel). RemoveonOptionAdd/onOptionRemovecalls and register withrootContext.labels.register(value, label, disabled)instead.- Old content ids in selectors or snapshots: select by
role="listbox"or the trigger'saria-controls; update snapshots. - In-place mutation of the
v-modelarray of an uncontrolledmultipleselect that expected an emit: assign a new array. Leave controlled models unchanged. - A test that expects an emit for re-pressing the selected item: assert that nothing was emitted and that the content closed. Ask if the app relied on the emit.
- Single-value handlers on a
multipleselect: type them as arrays. Do not change runtime logic.
Verify. Each select opens, selects and closes as before; forms submit the selected values; the type-check passes.
20. Date and time fields
What changed.
DateFieldRoot,TimeFieldRoot,DateRangeFieldRoot,TimeRangeFieldRoot,DatePickerRootandDateRangePickerRootemitupdate:modelValue(value, details)andupdate:placeholder(value, details), with a cancellablebeforeUpdate:*before each (section 2). A picker emits one pair per change, from the root, carrying the field's reason (segment-*,step-snap) or the calendar's (cell-press,cell-keydown);details.cancel()on the picker root cancels the typed change too. A cancelled change keeps the last committed value, and the segments keep what the user typed, so typing can continue to a value the handler accepts. The segments only follow the model when it actually changes: a controlled parent that ignores an update leaves them showing the typed value, as in v2.DatePickerRootandDateRangePickerRootno longer render aPopoverRootcomponent; they provide the Popover context themselves.:model-value="null"is a controlled empty value (also onCalendarRoot, as in v2; a controlled-emptyDatePickerRootkeeps its calendar controlled). For a controllednull,modelValueon theDateFieldRoot,TimeFieldRootandDatePickerRootcontexts readsundefined; theDateRangeFieldRootandTimeRangeFieldRootcontexts have nomodelValueand readundefinedfromstartValueandendValue;modelValueon theDateRangePickerRootcontext reads the empty range{ start: undefined, end: undefined }. A cleared field emitsundefined(single) or{ start: undefined, end: undefined }(range). The range roots'modelValueslot prop is typedDateRange/TimeRange(v2:DateRange | null/TimeRange | undefined).- A model set to a value equal to the current one emits nothing.
update:startValueonRangeCalendarRootandDateRangePickerRootis[date, details].beforeUpdate:startValueonDateRangePickerRootis new; cancelling it suppresses only thatupdate:startValue.TimeFieldRootemitsupdate:placeholderwith a time (Temporal.PlainTimein v3, see section 30) when the placeholder is one (v2: aCalendarDateTime).- Root contexts:
modelValue/placeholder(andstartValue/endValueon the range field contexts) are writable computeds that report'imperative-action'. New:setModelValue(value, reason?, event?),setPlaceholder(value, reason?, event?),setRangeValue(type, value, reason?, event?)(range fields), all returning a boolean. On the picker contexts,onDateChange(date, reason?, event?)andonPlaceholderChange(date, reason?, event?)return a boolean, andonStartValueChange(date, details?)takes the details. - The time zone segment renders
data-readonly=""(v2:data-readonly="true"). DateFieldRoot,DateRangeFieldRoot,DatePickerRootandDateRangePickerRoot: without alocaleprop and aplaceholder, the default placeholder uses theConfigProviderlocale, including its calendar system: under ath-TH,fa-IR,ar-SA(or other non-Gregorian)ConfigProviderthe emitted values are in that calendar, and.yearis that calendar's year.TimeFieldRootandTimeRangeFieldRootare unaffected: their default placeholder is aTemporal.PlainTime, and aPlainDateTimeorZonedDateTimeplaceholder or model keeps the calendar it was created with.- Rendered attributes can come in a different order; update snapshots.
- Additive:
isTimeUnavailableonTimeFieldRoot;stepSnappingonDateRangeFieldRoot,TimeRangeFieldRootandDateRangePickerRoot;stepSnappingon the picker roots now reaches the field;useDateField(),useTimeField(),useDateRangeField(),useTimeRangeField(),useDatePicker(),useDateRangePicker().
How to find it.
@update:model-value,@update:placeholderand@update:start-valueon the six roots and onRangeCalendarRoot;'update:modelValue','update:placeholder','update:startValue'in emit types of components that wrap them.findComponent(PopoverRoot)/findAllComponents(PopoverRoot)in date picker tests.=== null/!== nullchecks on themodelValueslot prop ofDateRangeFieldRoot/TimeRangeFieldRoot, and handlers that expectnullfrom a cleared field.injectDateFieldRootContext(,injectTimeFieldRootContext(,injectDateRangeFieldRootContext(,injectTimeRangeFieldRootContext(,injectDatePickerRootContext(,injectDateRangePickerRootContext(in custom parts.instanceof CalendarDateTime,isPlainDateTime(or'day' inchecks on aTimeFieldRootupdate:placeholderpayload.data-readonly="true"in selectors, styles and snapshots.- A
ConfigProviderwith alocalewhose default calendar is not Gregorian (th,fa,ar-SA, …) above a date or time field or picker that has nolocaleand noplaceholderprop, and code that reads.year, compares, stores or serializes the field's values. is-date-unavailable/isDateUnavailableonTimeFieldRoot(it was never applied there).
Rewrite rules.
- Wrapper emit types: add a
detailsargument typed with the root's own union, imported fromreka-ui:ChangeEventDetails<DateFieldChangeReason>onDateFieldRoot,TimeFieldChangeReasononTimeFieldRoot,DateRangeFieldChangeReasononDateRangeFieldRoot,TimeRangeFieldChangeReasononTimeRangeFieldRoot,DatePickerChangeReasononDatePickerRootandDateRangePickerChangeReasononDateRangePickerRoot, for bothupdate:modelValueandupdate:placeholder(for example[date: DateRange]onDateRangeFieldRootbecomes[date: DateRange, details: ChangeEventDetails<DateRangeFieldChangeReason>]).'update:startValue': [date: DateValue | undefined]getsdetails: ChangeEventDetails<RangeCalendarChangeReason>on bothRangeCalendarRootandDateRangePickerRoot. findComponent(PopoverRoot)under a picker: assert on the picker root'supdate:openor on the rendered[role=dialog]instead.- A
nullcheck on a range slot'smodelValue: replace with a check onmodelValue.start/modelValue.end. - Context writes such as
ctx.modelValue.value = datekeep working; leave them. Replace them withctx.setModelValue(date, reason, event)only where a reason is wanted. Code that awaitedonDateChangeor ignored its return value keeps working. - A
TimeFieldRootplaceholder handler that needs a date: convert withTemporal.Now.plainDateISO(tz).toPlainDateTime(time). Ask if the intent is unclear. [data-readonly="true"]: replace with[data-readonly]; update snapshots.- A field under a non-Gregorian
ConfigProviderlocale whose values are consumed as Gregorian (stored, sent to an API, compared with.year): ask the developer. If they want Gregorian values, bind aplaceholdercreated in<script setup>withTemporal.Now.plainDateISO()(or addlocale="en-US") to the root, or convert withvalue.withCalendar('iso8601'). - A
beforeUpdate:modelValueguard on a field: leave it. A cancelled typed change keeps the typed segments, so the user can keep typing to an accepted value. isDateUnavailableonTimeFieldRoot: rename toisTimeUnavailable(it receives a date-time). It now applies, so ask before keeping it if the matcher's result was never tested.- Do not add
stepSnappingorbeforeUpdate:*handlers on your own.
Verify. The type-check passes. Typing in each field and picking a day in each picker still updates the bound model, a cleared field reads as empty, and tests that assert on update:* payloads of these roots pass.
21. Tree, Pagination and Stepper
What changed.
TreeRoot,PaginationRootandStepperRootfollow section 2:beforeUpdate:modelValue/update:modelValue(value, details)andbeforeUpdate:expanded/update:expanded(value, details)on Tree,beforeUpdate:page/update:page(value, details)on Pagination,beforeUpdate:modelValue/update:modelValue(value, details)on Stepper. No emit when the value is unchanged; Tree selections compare bygetKey.- With
propagateSelectorbubbleSelect, a key that is already selected is no longer added a second time. v2 could list a parent (bubble) or a child (propagate) twice, and the next press removed only one copy. A press still emits once, as in v2, now synchronously with details and after one cancellablebeforeUpdate:modelValue. TreeRootwith:model-valueand noupdate:modelValuelistener no longer changes its selection on click (v2 kept a local copy).expandedalready behaved this way. Mutating either array in place (modelValue.push(…)on the slot value) no longer emits.- Root contexts: Tree
modelValueandexpandedare read-only,onSelect(value, reason?, event?)/onToggle(value, reason?, event?)return a boolean,handleMultipleReplacetakes the keyboard event as a fifth argument,setModelValue(value, reason?, event?)andsetExpanded(keys, reason?, event?)are new and write in one change, anditemsis typedT[] | undefined; Paginationpageis read-only andonPageChange(value, reason?, event?)returns a boolean; SteppermodelValueis read-only andchangeModelValue(value, reason?, event?)returns a boolean, and theStepperItemcontext's refs are read-only. goToStep,nextStepandprevStep(StepperRoot slot props and template ref) returnfalsewhen blocked, unchanged or cancelled. v2 returnedundefined.goToStep(step)onto a disabled step (itsStepperItemhasdisabled) is blocked: it returnsfalseand emits nothing. v2's check never fired, so it moved there.- New and additive:
useTree(),usePagination(),useStepper(),useToolbar().
How to find it.
TreeRootusages with:model-value/:modelValueand no@update:model-value,@update:modelValueorv-model.TreeRootwithpropagate-selectorbubble-select, and code reading its selection that removes duplicates by hand or counts entries.- Calls to
goToStep(with a step that can be disabled. injectTreeRootContext(,injectPaginationRootContext(,injectStepperRootContext(,injectStepperItemContext(in custom parts; within them, assignments to.modelValue.value,.expanded.value,.page.value,.step.value,.state.value,.disabled.value,.isFocusable.value, and calls tohandleMultipleReplace.- In-place mutation of a tree's selection or expanded array:
.push(,.splice(,.pop(on theTreeRootslot'smodelValue/expandedor on the boundv-modelarray. - Uses of the return value of
goToStep(,nextStep(orprevStep(. - Emit types in components that wrap these roots (
'update:modelValue','update:expanded','update:page').
Rewrite rules.
- A
TreeRootbound with:model-valueand no listener: if the developer meant it to be interactive, replace it withv-model; if only an initial selection was intended, replace it with:default-value. Ask when the intent is unclear. - Hand-written de-duplication of a propagated or bubbled selection: leave it (it is now a no-op). Code that counted duplicated entries: ask.
- A
goToStep(that relied on reaching a disabled step: ask whether the step should stay disabled. - Custom parts:
ctx.modelValue.value = von Tree →ctx.onSelect(item)for a toggle-style selection, orctx.setModelValue(v)when the code writes a whole selection (select-all, clear).ctx.expanded.value = keys→ctx.setExpanded(keys)(expand-all, collapse-all), orctx.onToggle(item)for a single item.ctx.page.value = n→ctx.onPageChange(n). Stepperctx.modelValue.value = n→ctx.changeModelValue(n). - In-place mutation of a tree's selection or expanded array: replace it with an assignment of a new array (
model.value = [...model.value, item]). - Code that tested the result of
goToStep,nextSteporprevStepagainstundefined: compare againstfalseinstead. Leave calls whose result is ignored. - Wrapper emit types: add the
detailselement, importingChangeEventDetailsand the reason union (TreeChangeReason,TreeExpandedChangeReason,PaginationChangeReason,StepperChangeReason) fromreka-ui. Wrappers that useuseForwardPropsEmitsneed no change.
Verify. The type-check passes; selecting, expanding and Shift-range-selecting in each tree, paging, and stepping behave as before; a propagated or bubbled selection lists each key once; a disabled step cannot be reached through goToStep.
22. Splitter layout model and Progress corrections
What changed.
SplitterGrouphas alayoutmodel: a newlayoutprop (v-model:layout), a cancellablebeforeUpdate:layoutandupdate:layout(value, details)withSplitterLayoutChangeReason('drag' | 'keyboard' | 'panel-change' | 'group-resize', plus'imperative-action'for the panelcollapse()/expand()/resize()methods). Values are in each panel'ssizeUnit, the same as@layout.@layoutis unchanged and still fires for every applied layout, including the initial one.- Only
drag,keyboardandimperative-actionare cancellable.panel-change(including the initial layout and a controlled layout corrected to fit the constraints) andgroup-resizeare structural: they skipbeforeUpdate:layout, are always applied, and still emitupdate:layout. - A controlled
layoutis a request: one that breaks the constraints is applied as corrected and the correction emitted once; one with the wrong length is ignored with a development warning;autoSaveIdstorage is neither read nor written while controlled; and a user change applies (with@layout, the panel events andgetSize()) only after the parent passes it back. - Enter on a
SplitterResizeHandle(collapse toggle) now emitsupdate:layoutwith reason'keyboard',@layoutand the panelcollapse/expand/resizeevents. v2 changed the layout silently. - A focused
SplitterResizeHandlenow hasdata-resize-handle-active="keyboard"(v2 never set it). ProgressRootrenders an invalidmodelValue(negative, abovemax,NaN) as indeterminate and an invalidmaxas100straight away; v2 rendered the invalid value until the parent applied the correction. The value is validated against the correctedmax, so loweringmaxbelow the value renders indeterminate and emitsupdate:modelValue(null). The correction emits are unchanged and stay single-argument;update:modelValueis now typed[value: number | null](v2:[value: string[] | undefined]).ToolbarSeparatorruns perpendicular to its toolbar (Radix parity):data-orientation/aria-orientationareverticalin a horizontal toolbar. v2 used the toolbar's orientation.AvatarFallbackwithdelayMs0renders immediately; v2 never rendered it.
How to find it.
@layouthandlers onSplitterGroupthat write the layout back into the panels (for example throughdefault-sizeand a cookie).@collapse/@expand/@resizehandlers onSplitterPanel, and@layouthandlers, that assumed Enter did not trigger them.- CSS or tests that select
[data-resize-handle-active]. beforeUpdate:layouthandlers that cancelpanel-changeorgroup-resize.ToolbarSeparatorstyles or tests keyed on[data-orientation].- Wrapper components that re-declare the
ProgressRootemits, or handlers typed againststring[].
Rewrite rules.
- Leave
@layouthandlers unchanged. Suggestv-model:layoutonly where the code mirrors the layout into its own state and the developer agrees: ask. - Handlers that must ignore keyboard collapses: ask.
[data-resize-handle-active]styles meant for the pointer only: change the selector to[data-resize-handle-active="pointer"].- Cancelling
panel-change/group-resize: the cancel has no effect; ask before removing it. ToolbarSeparatorselectors on[data-orientation]: swaphorizontalandverticalin the selector.- Progress wrapper emit types:
'update:modelValue': [value: string[] | undefined]→'update:modelValue': [value: number | null].
Verify. The type-check passes, and the Splitter, Progress, Toolbar and Avatar tests pass.
23. NavigationMenu and Toast
What changed.
update:modelValueonNavigationMenuRootandNavigationMenuSub, andupdate:openonToastRoot, carry details, andbeforeUpdate:modelValue/beforeUpdate:openare new (section 2). Reasons:NavigationMenuChangeReason('trigger-press' | 'trigger-hover' | 'pointer-leave' | 'escape-key' | 'outside-press' | 'focus-outside' | 'link-press') andToastOpenChangeReason('timeout' | 'close-press' | 'action-press' | 'swipe' | 'escape-key'). Toasts from the toast manager emit them too.- A controlled
NavigationMenuRootno longer emitsupdate:modelValuewith its current value, and a managed toast no longer emits a secondupdate:openwhen its timer runs out after it closed. NavigationMenuContentemitspointerDownOutsideandfocusOutsideonce per interaction (v2 emitted each twice), andinteractOutsideonce for an outside press and once for a focus move outside (v2 emitted it only for the focus move, twice).preventDefault()ininteractOutsidekeeps the menu open.- A press on a trigger whose hover open was cancelled opens the menu with
trigger-press. - Trigger
idandaria-controlsrender from the first render instead of after mount. - NavigationMenu context (
injectNavigationMenuContext()):modelValue,dir,disableClickTrigger,disableHoverTriggerandunmountOnHideare read-only refs;onItemSelect(value, reason?, event?)andonItemDismiss(reason?, event?)return a boolean;onTriggerEnter,onTriggerLeaveandonContentLeavetake an optional event. - Toast root context (
injectToastRootContext()):onClose(event?, reason?)takes an optional reason and returns a boolean. TheToastProviderContextsettings refs are read-only, andisFocusedToastEscapeKeyDownRefis removed. - A cancelled toast timeout, or one a controlled parent ignores, restarts the timer with the full
duration, so the toast asks again later; a cancelled swipe snaps back. - Toast manager:
ToastObject.onClose(details)receives the close details (details.reasonis aToastOpenChangeReasonor'imperative-action').manager.close(id)closes a rendered toast through itsToastRoot:beforeUpdate:open(cancellable) andupdate:openfire with'imperative-action'. - New and additive:
useNavigationMenu(),useNavigationMenuSub()and the NavigationMenu part composables;useToastProvider(),useToastRoot(),useToastTimer(),useToastSwipe()anduseToastViewport().
How to find it.
injectNavigationMenuContext(in custom parts; within them, assignments tomodelValue.value.injectToastRootContext(in custom parts that callonClose.@pointer-down-outside,@focus-outsideor@interact-outsidehandlers onNavigationMenuContentthat count calls, or that assumeinteractOutsideonly follows a focus move.onClosecallbacks intoast.add(...)/useToastManager()calls, andbeforeUpdate:open/update:openhandlers on managedToastRoots that switch ondetails.reason.isFocusedToastEscapeKeyDownRefin custom Toast parts.- Tests that count
update:modelValueemits on a controlledNavigationMenuRoot, orupdate:openemits on aToastRootwith atoastprop. - Snapshots of
NavigationMenuTriggerrendered on the server or before mount.
Rewrite rules.
context.modelValue.value = xon the NavigationMenu context: replace withcontext.onItemSelect(x)(orcontext.onItemDismiss()for'').toastRootContext.onClose(event): leave unchanged. Add a reason only if the custom part should report one other than'imperative-action'.- A handler on
NavigationMenuContentthat compensated for the double emit (for example, ignoring every second call): remove the compensation. If unsure: ask. - A test expecting an emit for an unchanged value: assert that nothing was emitted.
- An
@interact-outsidehandler onNavigationMenuContentthat should only react to focus moves: checkevent.type(or move it to@focus-outside). If unsure: ask. - A
beforeUpdate:open/update:openhandler on a managedToastRootthat should not react tomanager.close(id): skipdetails.reason === 'imperative-action'. isFocusedToastEscapeKeyDownRef: remove the reference; nothing read it.- A snapshot that lacked the trigger
id/aria-controls: update the snapshot.
Verify. Each navigation menu opens on hover and press and closes on Escape, outside press and link press as before; toasts time out, close, swipe away and pause on hover as before; the type-check passes.
24. Auto-imports use per-component entry points
What changed.
- Every component family has its own entry point that exports the same objects as the package root. The name is the family in kebab-case:
reka-ui/dialog,reka-ui/alert-dialog, …. - The Nuxt module (
reka-ui/nuxt) now imports each auto-imported component from its entry point instead of fromreka-ui. It addsreka-uiand those entry points to the clientoptimizeDeps.include, skipping any the app excludes. - The
unplugin-vue-componentsresolver (reka-ui/resolver) is unchanged: it imports fromreka-uiunless the project opts in withRekaResolver({ subpaths: true }). import { X } from 'reka-ui'is unchanged and keeps working, also mixed with entry-point imports.
How to find it.
reka-ui/nuxtinnuxt.config.*(or in a Nuxt layer's config).- In a project that uses the Nuxt module, configuration that matches the exact specifier
reka-ui:- an
alias/vite.resolve.aliasentry; vite.optimizeDepsorvite.ssr.noExternalentries written as regular expressions that end atreka-ui(/^reka-ui$/);- a Vitest or Jest mapping keyed on
^reka-ui$.
- an
Rewrite rules.
- Do not rewrite the project's own
import … from 'reka-ui'statements; root imports stay valid. - Exact-specifier configuration: extend the pattern to the subpaths (
/^reka-ui(\/.*)?$/). - If an alias redirects
reka-uito a local copy or a fork that has no per-component entry points, ask whether to setreka: { subpaths: false }innuxt.config.tsinstead. - Do not add
subpaths: falseto the Nuxt module, orsubpaths: trueto the resolver, on your own.
Verify. The type-check passes. The dev server and the build start without Failed to resolve import "reka-ui/…" or Cannot find module 'reka-ui/…' errors.
25. Exit animations wait for CSS transitions
What changed.
Presence(every content, overlay, indicator and toast) keeps a closing element mounted until all of its own CSS transitions and animations have finished (element.getAnimations()); v2 only waited for a changedanimation-name. Elements with no transition or animation, and keyframe exits, behave as before. Descendants' animations and infinite animations are not waited for.- The managed element carries
data-starting-stylefor the first frame after an open mounts it anddata-ending-stylefrom the close until its exit finishes. Neither is rendered without Web Animations (jsdom). - Every root with an
openmodel emitsupdate:openComplete(trueafter the open animations finish,falseafter the close animations finish):DialogRoot,AlertDialogRoot,DrawerRoot,PopoverRoot,TooltipRoot,HoverCardRoot,DropdownMenuRoot,DropdownMenuSub,ContextMenuRoot,ContextMenuSub,MenubarMenu,MenubarSub,SelectRoot,ComboboxRoot,AutocompleteRoot,DatePickerRoot,DateRangePickerRoot,CollapsibleRoot,AccordionItem,ToastRoot, andNavigationMenuRoot(from itsNavigationMenuViewport). The root composables takeonOpenComplete; the root contexts have a new optionalnotifyOpenComplete(value: boolean)method. - Everything running on the element when it closes is waited for, including unrelated transitions (hover colours) and paused animations; there is no timeout, so a close in a background tab completes when the tab's animations run again.
DrawerRoot'supdate:openCompletefires once all popup animations finish (not on the firsttransitionend/animationend), also when nothing animates, and after opening as well as closing.Presencehas a newappearprop and acompleteevent; itsafter-enterevent fires after the enter transitions finish.
How to find it.
- CSS, Tailwind classes and
cva/tailwind-variantsdefinitions that put atransition(transition,transition-*,transition-all,duration-*) on a Reka UI content, overlay, viewport, indicator, toast or scrollbar element. - Exit animation workarounds:
forceMountcombined with a hand-writtenv-if,setTimeoutortransitionendlistener that delays unmounting a Reka UI part;<Transition>wrappers around a Reka UI part that only exist to animate its exit. @update:open-complete/onUpdate:openCompleteonDrawerRoot.- Real-browser tests (Playwright, Cypress, Vitest browser mode) that assert a part is removed right after closing it, and real-browser DOM snapshots of opening or closing parts.
Rewrite rules.
- A
transitionon a part that is meant to animate open and close: leave it, and if the enter or exit state is expressed withdata-state="closed"or a hand-made class, ask whether to move it to[data-starting-style]/[data-ending-style](Tailwind:data-[starting-style]:…/data-[ending-style]:…). - A
transitionon a part that is only meant for hover or focus feedback (for exampletransition-colorson a menu content): leave it. The close now waits for any of those transitions that are running, which is at most their duration. Ask if the developer wants the content to disappear instantly; then scope the transition to the hovered state. - A workaround that delays unmounting by hand: ask before replacing it with
data-ending-stylestyles, since it may coordinate more than the animation. - A
DrawerRootupdate:openCompletehandler that assumed it fires only after closing: add a check on the emitted value (if (!value) …). - A real-browser test that expects a part to be gone immediately after closing: wait for its removal (
expect.poll,vi.waitFor,await expect(locator).toBeHidden()) instead of asserting it synchronously. - A real-browser snapshot that now contains
data-starting-styleordata-ending-style: take it after the animation settled, or update it.
Verify. Open and close each animated part: enter and exit transitions play, and the part leaves the DOM once they end. The type-check passes. jsdom unit tests and their snapshots are unchanged.
26. Closed popups render no portal
What changed.
- The portal of a closed popup (
DialogPortal,AlertDialogPortal,DrawerPortal,PopoverPortal,HoverCardPortal,TooltipPortal,DropdownMenuPortal,ContextMenuPortal,MenubarPortal,ComboboxPortal) renders nothing until the popup first opens: no Teleport anchors in<body>and no content or overlay component instance. It stays rendered from then on. This applies only when the portal holds nothing but its family's content and overlay parts; withforceMounton the portal or on one of those parts, withunmountOnHide: false(Dialog, Combobox), or with anything else inside (an element, a<Transition>, a custom component), the portal renders right away as before. - An unchecked or unselected
CheckboxIndicator,RadioGroupIndicator,SelectItemIndicatorand menu item indicator mounts noPresenceuntil it is first shown.
How to find it.
- Template refs on
*Content/*Overlayparts inside one of these portals that are read while the popup has never been opened. - Tests that count elements in
<body>or look up content component instances (findComponent(DialogContent)) before the first open.
Rewrite rules.
- A template ref read before the first open: it is
undefineduntil then. Read it in awatchon the ref, after opening, or addforce-mountto the portal if the content must exist while closed. - A test that finds a content component instance before opening: open first, or assert that it does not exist.
Verify. The type-check passes. Each popup opens with its enter animation, including the first time, and closes with its exit animation.
27. Shadow DOM
Apart from the forceMount timing in the last bullet below, skip this section when the project never renders Reka UI inside a shadow root (no attachShadow(, no defineCustomElement(, no web-component or micro-frontend mounting).
What changed.
- A portal (
DialogPortal,PopoverPortal,SelectPortal,TooltipPortal, any*PortalorTeleportpart) rendered inside a shadow root teleports into that shadow root by default. v2 teleported todocument.body, outside the shadow root. - A string
toon a portal, orteleportToonConfigProvider, is looked up inside the shadow root first and then in the document. An explicitto="body"still targets the document body. - A modal layer also sets
aria-hiddenon its siblings inside the shadow root, not only on the page around the shadow host. With modals open in two shadow roots, the most recently opened one stays exposed. - Pointer, focus and dismissal checks follow the rendered (flat) tree: a press inside a web component nested in a trigger, Splitter handle or popup counts as a press on that element, and light-DOM content slotted into a popup counts as inside it.
TooltipContentandHoverCardContentclose when a scroll container inside the shadow root, or the page, scrolls their trigger.- Combobox mouse selection, focus trapping and focus guards, outside-press and focus-outside dismissal, and
aria-*id references work inside an open shadow root without workarounds. - Light DOM too: a portal with
forceMountand the default target (noto, or a selector) that renders during the app's first client render mounts its content right after the portal mounts (a microtask later), as a portal withoutforceMountdoes, instead of during that first render. A parent's template ref to that content isundefinedin the parent'sonMounted. Portals withdisabledor an elementto, server rendering, hydration and portals created after the app mounted are unchanged.
How to find it.
attachShadow(,defineCustomElement(and custom-element registration that mounts a Vue app using Reka UI.teleportToonConfigProvider, ortoon*Portalparts, in those apps, especially a target element created only to keep portalled content inside the shadow root.- Stylesheets for portalled content (dialogs, popovers, menus, tooltips, toasts) of a shadow-mounted app that are loaded into the document rather than the shadow root.
- Tests of a shadow-mounted app that query portalled content with
document.querySelector,document.getElementByIdor testing-libraryscreenqueries. - Tests that mount an app whose
*PortalhasforceMountand query the portalled content synchronously right aftermount(). onMountedhooks that read a template ref placed inside force-mounted portal content (a*PortalwithforceMountand no elementto) rendered by the same component or a child.- Workarounds for shadow DOM bugs: patches of
reka-ui(for examplepatches/reka-ui@*.patchtouchingComboboxInputorgetElementById),touchstart/touchmovestopPropagation()on dialog content, or code that re-parents portalled content into a shadow root.
Rewrite rules.
- A
teleportTo/tothat points at an element inside the shadow root: leave it unchanged; it keeps working. If the target element exists only to keep content inside the shadow root, ask whether to remove it together with the prop. - Styles for portalled content of a shadow-mounted app that live in the document: ask whether to move them into the shadow root (recommended) or to keep the content in the document with
teleportTo="body". - A test that finds portalled content of a shadow-mounted app through
document: when the portal has noto/teleportTo, or one that resolves inside the shadow root, query the shadow root instead (host.shadowRoot.querySelector(...)). Leave document queries for content teleported tobodyor another element outside the shadow root. - A workaround or patch for one of the fixes listed under What changed: ask before removing it, and remove it only after the verify step passes without it.
- A test that reads force-mounted portal content synchronously after
mount(): addawait nextTick()(orawait flushPromises()) before the query. - An
onMountedthat reads a template ref into force-mounted portal content: read it afterawait nextTick()inside the hook, or move the code into awatchon the ref ({ once: true }when it should run once). Do not addtoordisabledonly to restore the old timing unless the developer asks.
Verify. In each shadow-mounted app, portalled content without an explicit target outside the shadow root renders inside the shadow root with its styles applied; dialogs trap focus and close on Escape and outside press; a combobox item can be selected with the mouse; the tests pass.
28. Drawer contract and part names, Tree custom children, Combobox blur reset, Autocomplete item values
What changed.
DrawerRootfollows the change-event contract: the newbeforeUpdate:openfires before an open change anddetails.cancel()there keeps the drawer as it is;update:open(value, details)now fires after the change, sodetails.cancel()inside it has no effect (a development warning says so).update:snapPointgains adetailsargument and the newbeforeUpdate:snapPointcan cancel a snap; cancelling thenullsnap-point request from a swipe past the last point keeps the drawer open, and a cancelled swipe close, or one a controlledopenignores, restores the previous snap point. Closing resets the snap point todefaultSnapPoint(else the first snap point). A controlledsnapPointlatches.DrawerOpenChangeDetailsis a deprecated alias ofChangeEventDetails<DrawerOpenChangeReason>.DrawerPopup/DrawerBackdrop(andDrawerPopupProps,DrawerPopupEmits,DrawerBackdropProps) are the canonical names;DrawerContent/DrawerOverlayand their types are deprecated aliases.DrawerHandleis renamedDrawerGrabber(DrawerHandleProps→DrawerGrabberProps, namespacedDrawer.Handle→Drawer.Grabber,useDrawer().handle→.grabber,DrawerHandleState→DrawerGrabberState); there is noDrawerHandleexport.- A
force-mountpopup returns focus to the trigger (orfinalFocus) on close, asDialogContentdoes, while focus is still inside the popup or on<body>. TreeRootwithpropagate-selectorbubble-selectreads every level of descendants throughgetChildren; v2 readitem.childrenbelow the first level. It also warns in development when either flag is set withoutmultiple.- With
resetSearchTermOnBlur(on by default forComboboxRoot, off forAutocompleteRoot),ComboboxRootandAutocompleteRootdrop the pending blur reset when the user types within a tick of closing, even whenbeforeUpdate:opencancels that reopen; another open request (click, focus) drops it only once the popup opens, and a controlledopenset back totruekeeps the text. A cancelled click or focus still resets the input. AutocompleteRootis generic over its item value typeT(defaultstring):displayValue: (value: T) => string,filter: ListboxFilterFunction<T>, thehighlightpayload'svalue: T, exposedhighlightItem(value: T).
How to find it.
@update:open/@update:snap-pointhandlers onDrawerRoot, especially ones callingdetails.cancel();DrawerOpenChangeDetailsimports.DrawerHandle,DrawerHandleProps,DrawerHandleState,Drawer.Handle,.handleon auseDrawer()result;DrawerContent,DrawerOverlay,DrawerContentProps,DrawerContentEmits,DrawerOverlayProps.TreeRootwith aget-children/getChildrenthat reads a key other thanchildren, together withpropagate-selectorbubble-select; and either flag withoutmultiple.AutocompleteRootwith adisplay-value/filter/@highlighthandler and items whosevalueis not a string.highlightItem(calls on anAutocompleteRootref, and the argument each one passes.ComboboxRootwithout:reset-search-term-on-blur="false"(the reset is on by default) andAutocompleteRootwithreset-search-term-on-blur/resetSearchTermOnBlurset, especially ones with a@before-update:openhandler that cancels opening or a parent that reopens throughv-model:open.
Rewrite rules.
- A
details.cancel()call in an@update:openhandler onDrawerRoot: move that handler (or the cancelling branch) to@before-update:open. A controlled drawer that guarded:openby hand only to support cancelling can go back tov-model:open; ask if it does more. - An
@update:snap-pointhandler that took one argument: leave it; the new second argument is optional to read. DrawerHandle→DrawerGrabber,DrawerHandleProps→DrawerGrabberProps,DrawerHandleState→DrawerGrabberState,Drawer.Handle→Drawer.Grabber,.handle→.grabber. Rename CSS class names only if the project wants them to match.DrawerContent→DrawerPopup,DrawerOverlay→DrawerBackdrop, and their prop/emit types likewise. Optional: the old names still work.DrawerOpenChangeDetails→ChangeEventDetails<DrawerOpenChangeReason>(optional).- Focus moved to the trigger by hand after closing a
force-mountdrawer: remove it. - Code that selected a tree's grandchildren by hand to work around
propagateSelect: ask before removing it. propagate-select/bubble-selectwithoutmultiple: ask whether the tree should bemultiple; otherwise remove the flag.- An
AutocompleteRootdisplayValue/filter/highlighthandler typed withstringwhile items carry other values: type its parameter from the item value type. - A
highlightItem(value)call: pass the samevaluethe matchingAutocompleteItemgets. Where that value is not a string and the type-check rejects it, type the root'sdisplayValueorfilterparameter from the item value type soTis inferred; ask before casting. resetSearchTermOnBlurusage: no rewrite. Remove a hand-written workaround that restored the typed text after a quick close and reopen only after asking.
Verify. The type-check passes; no DrawerHandle import remains; a cancelled beforeUpdate:open keeps each drawer as it was, with v-model:open too; a force-mount drawer returns focus on close; propagated and bubbled tree selections include every level. For each ComboboxRoot and AutocompleteRoot with the blur reset on: close the popup and type straight away, and the typed text stays, also when a beforeUpdate:open handler cancels the reopen; close it and click the trigger with the reopen cancelled, and the input shows the selected value again. For an AutocompleteRoot with non-string item values: displayValue, filter, @highlight and highlightItem receive the item value unchanged, and highlightItem(value) highlights that item.
29. Change details coverage
What changed.
- The
CheckboxItemandRadioGroupparts ofDropdownMenu,ContextMenuandMenubaremitbeforeUpdate:modelValue(cancellable) andupdate:modelValue(value, details), withdetails.reason === 'item-press'(MenuCheckboxItemChangeReason,MenuRadioGroupChangeReason) and the click asdetails.event. Pressing the radio item that is already checked no longer emitsupdate:modelValue. Theselectevent of every menu item carries the click asevent.detail.originalEvent. ListboxRoot'supdate:modelValue/beforeUpdate:modelValueare typed bymultiple(T[]with it,T | undefinedwithout it; newListboxModelValue<T, M>type). Type-only.useFilter()(and the default Combobox / Autocomplete filter) collates in theConfigProviderlocale instead of'en'.- New and opt-in:
SelectVirtualizer(requiresposition="popper"), grouped virtualizeroptions(thegroupedprop,VirtualGroup,groupslot) onListboxVirtualizer,ComboboxVirtualizerandSelectVirtualizer. Withoutgrouped,optionsis always flat. A functionestimateSizeon a grouped virtualizer receives the row index, header rows included. Object options needtext-content(the option text for typeahead and filtering). Separately, the virtualizers register no label per option, and on long object lists a keyby(by="id") is expected:byonly decides value equality, and a functionbycompares values one by one. ComboboxInputandAutocompleteInputemitupdate:modelValue(text, details)withComboboxInputChangeReason/AutocompleteInputChangeReason:'input-change' | 'input-clear' | 'clear-press' | 'escape-key' | 'item-press', plus'none'.ComboboxInputalso emits a cancellablebeforeUpdate:modelValue;AutocompleteInputhas none.ComboboxCancelnow also clears theComboboxInputv-model.FieldControlemitsupdate:modelValue(value, details)withreason: 'none'and the nativeinputevent, and nobeforeUpdate.- An uncontrolled
AutocompleteRoot(nov-model) ignoresdetails.cancel()inbeforeUpdate:modelValue, as in Base UI. A controlled one still keeps its text. - These keep a single-argument
update:*on purpose:ListboxFilterandDropdownMenuFilter(modelValue, the input text),RovingFocusGroup(currentTabStopId),update:color/update:hexon the color roots,update:stateonEditableRoot,update:validModelValueonRangeCalendarRoot,update:openCompleteon the roots with anopenmodel (section 25), andProgressRoot(section 22).
How to find it.
@update:model-value,@update:modelValue,onUpdate:modelValueanddefineEmitsonDropdownMenuCheckboxItem,DropdownMenuRadioGroup,ContextMenuCheckboxItem,ContextMenuRadioGroup,MenubarCheckboxItemandMenubarRadioGroup, and tests that assert their emitted payloads.- Explicit type annotations on
ListboxRootupdate:modelValuehandlers. useFilter(calls andComboboxRoot/AutocompleteRootwithout afilterprop, in apps that set a non-EnglishConfigProviderlocale.ListboxVirtualizer,ComboboxVirtualizer,AutocompleteVirtualizerandSelectVirtualizerusages whoseoptionsare{ label, options }groups.beforeUpdate:modelValuelisteners on anAutocompleteRootwithoutv-modelthat calldetails.cancel().- Wrappers that re-declare
ComboboxInputEmits,AutocompleteInputEmitsorFieldControlEmits, and tests that assert the exactupdate:modelValuearguments ofComboboxInput,AutocompleteInputorFieldControl.
Rewrite rules.
- Menu checkbox / radio listeners that only read the first argument: leave unchanged. Wrappers that re-declare the emit types: use
[value: boolean, details: ChangeEventDetails<MenuCheckboxItemChangeReason>]and[value: AcceptableValue, details: ChangeEventDetails<MenuRadioGroupChangeReason>], as in section 2. - Tests expecting
update:modelValuewhen the checked radio item is pressed again: assert that nothing was emitted. ListboxRoothandlers: no change; narrow the parameter type only if the type-check now asks for it.useFilter/ default filtering under a non-English locale: leave unchanged unless a test or the developer relies on English matching. If one does: ask whether to pass afilterfunction or wrap the component in<ConfigProvider locale="en">.- Do not add
SelectVirtualizeror groupedoptionson your own; mention longSelectContentlists in the report as optional candidates forSelectVirtualizer. - A virtualizer whose
optionsare groups: addgrouped. - An uncontrolled
AutocompleteRootwhosebeforeUpdate:modelValuecancels: ask whether to bindv-modelon it so the veto keeps working. - Input text listeners that only read the first argument: leave unchanged. Tests that assert
toHaveBeenCalledWith(text)on these parts: addexpect.anything()(orexpect.objectContaining({ reason })) for the second argument.
Verify. The type-check passes; menu checkbox items and radio groups still toggle with v-model; filtered lists match as before under the app's locale, or the developer confirmed the change.
30. Temporal instead of @internationalized/date
What changed.
- The date components (
Calendar,RangeCalendar,DateField,DateRangeField,DatePicker,DateRangePicker,TimeField,TimeRangeField) take and emit Temporal values instead of@internationalized/dateobjects. Reka UI no longer depends on@internationalized/date. DateValue(exported fromreka-ui) isTemporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime.TimeValueisTemporal.PlainTime | Temporal.PlainDateTime | Temporal.ZonedDateTime. EverymodelValue,placeholder,minValue,maxValue, matcher argument, slot prop, context value and emitted value uses these types.- Reka UI reads the global
Temporaland bundles no polyfill. A date component that mounts without a globalTemporalthrows[Reka UI] The date components need the Temporal API…in development and[Reka UI] Temporal is not defined…in production. - The types come from TypeScript 6's
esnext.temporallib. Projects need TypeScript 6 withESNext(orESNext.Temporal) inlib, or a polyfill's global types. Temporal.PlainDate.yearis the arithmetic year. In calendars with eras the year a user reads iseraYear: Reiwa 6 hasyear2024 anderaYear6, and 1 BCE ingregoryhasyear0 anderaYear1.@internationalized/date'syearwas the year of the era. The year segment of the fields still shows and edits the year of the era.- New values for Gregorian locales (the default placeholder, today) use the
iso8601calendar instead ofgregory.calendarIdis'iso8601'anderaisundefined. Non-Gregorian locales still get their calendar (th-TH→buddhist). erais a lower-case Temporal era code, andundefinedfor aniso8601value. Changed codes:gregoryAD/BC→ce/bce;rocminguo/before_minguo→roc/broc;buddhistBE→be,persianAP→ap,islamic-*AH→ah,hebrewAM→am. Japanese era names (reiwa,heisei, …) are unchanged.- The first day of the week comes from
Intl.Locale.prototype.getWeekInfo(), with a CLDR table as fallback. A few regions differ from v2, for exampleAEnow starts on Monday.weekStartsOnstill overrides it. reka-ui/date:isCalendarDateTimeis renamedisPlainDateTime(the old name stays as a deprecated alias).isWeekend,isPlainDate,isPlainTime,isDateValue,compareDateValues,compareDays,isSameDay,isSameMonth,isToday,today,getLocalTimeZone,toCalendar,toPlainDate,toPlainDateTime,toIsoString,startOfMonth,endOfMonth,startOfYear,endOfYear,startOfWeek,getDayOfWeek,getLocaleWeekStart,getFieldValue,setFieldsandcycleFieldare new.toDate(value, timeZone?)keeps its signature.useDateFormatter()methods accept Temporal values (and stillDate). A plain value is formatted from its own fields, aZonedDateTimein its own zone and a non-ISO value in its calendar.- Unchanged: hidden form input values and
data-valueattributes are ISO strings without a calendar annotation, as v2'stoString()produced.
How to find it.
@internationalized/datein imports,package.json,optimizeDeps,ssr.noExternal, auto-import presets and Vitestdeps/server.depsconfig.- Its names in code:
CalendarDate,CalendarDateTime,ZonedDateTime,Time,parseDate,parseDateTime,parseTime,parseZonedDateTime,parseAbsolute,parseAbsoluteToLocal,today(,now(,getLocalTimeZone(,fromDate(,toZoned(,toCalendarDate(,toCalendarDateTime(,toTime(,toCalendar(,isSameDay(,isSameMonth(,isEqualDay(,isToday(,isWeekend(,getDayOfWeek(,startOfMonth(,endOfMonth(,startOfWeek(,DateFormatter,createCalendar(, andnew GregorianCalendar()(or any other*Calendarclass). - Methods on date values:
.set(,.cycle(,.copy(,.compare(,.toDate(,.calendar.identifier,.timeZone,.offset. isCalendarDateTimeimported fromreka-ui/date.DateValueimported from@internationalized/date.- Code that reads
.yearor.eraof a date value in a calendar with eras (japanese,roc,gregoryBCE dates), comparisons of.erawith a string ('AD','BC','minguo', …), andcalendar.identifier === 'gregory'checks. <,>,===or==between two date values, and+date/Number(date)/date.valueOf()(Temporal throws onvalueOf).tsconfig*.jsonfiles: theirlibsetting and thetypescriptversion inpackage.json.- Test files and stories that build date values. Snapshots that print them.
Rewrite rules.
@internationalized/date | Temporal |
|---|---|
import type { DateValue } from '@internationalized/date' | import type { DateValue } from 'reka-ui' |
CalendarDate / CalendarDateTime / ZonedDateTime / Time (types) | Temporal.PlainDate / Temporal.PlainDateTime / Temporal.ZonedDateTime / Temporal.PlainTime |
new CalendarDate(2024, 7, 10) | new Temporal.PlainDate(2024, 7, 10) |
new CalendarDateTime(2024, 7, 10, 12, 30) | new Temporal.PlainDateTime(2024, 7, 10, 12, 30) |
new Time(9, 30) | new Temporal.PlainTime(9, 30) |
new ZonedDateTime(2024, 7, 10, 'America/New_York', offset, 12, 30) | Temporal.ZonedDateTime.from({ year: 2024, month: 7, day: 10, hour: 12, minute: 30, timeZone: 'America/New_York' }) |
new CalendarDate(new JapaneseCalendar(), 'reiwa', 6, 5, 1) | Temporal.PlainDate.from({ calendar: 'japanese', era: 'reiwa', eraYear: 6, month: 5, day: 1 }) |
new CalendarDate(new HebrewCalendar(), 5784, 7, 1) | Temporal.PlainDate.from({ calendar: 'hebrew', year: 5784, month: 7, day: 1 }) |
parseDate(s) / parseDateTime(s) / parseTime(s) / parseZonedDateTime(s) | Temporal.PlainDate.from(s) / Temporal.PlainDateTime.from(s) / Temporal.PlainTime.from(s) / Temporal.ZonedDateTime.from(s) |
parseAbsolute(s, tz) | Temporal.Instant.from(s).toZonedDateTimeISO(tz) |
parseAbsoluteToLocal(s) | Temporal.Instant.from(s).toZonedDateTimeISO(Temporal.Now.timeZoneId()) |
today(tz) / now(tz) | Temporal.Now.plainDateISO(tz) / Temporal.Now.zonedDateTimeISO(tz) |
getLocalTimeZone() | Temporal.Now.timeZoneId() |
fromDate(date, tz) | Temporal.Instant.fromEpochMilliseconds(date.getTime()).toZonedDateTimeISO(tz) |
value.toDate(tz) | toDate(value, tz) from reka-ui/date |
toZoned(value, tz) | value.toZonedDateTime(tz) for a PlainDate (the start of that day) or a PlainDateTime; value.withTimeZone(tz) for a ZonedDateTime |
toCalendarDate(value) | toPlainDate(value) from reka-ui/date (works on every DateValue; Temporal's PlainDate has no toPlainDate() method) |
toTime(value) | value.toPlainTime() (value is a PlainDateTime or ZonedDateTime) |
toCalendarDateTime(date, time) | date.toPlainDateTime(time) when date is a PlainDate; toPlainDateTime(value) from reka-ui/date when it may be any DateValue and there is no time |
toCalendar(value, new GregorianCalendar()) | value.withCalendar('gregory'), or 'iso8601' for an unannotated ISO date |
value.calendar.identifier | value.calendarId |
value.set({ month: 8 }) | value.with({ month: 8 }) (in a calendar with eras, set era and eraYear instead of year) |
value.add(…) / value.subtract(…) | unchanged |
value.cycle('month', 1) | cycleField(value, 'month', 1) from reka-ui/date |
value.copy() | value (Temporal values are immutable; share them) |
a.compare(b) | compareDateValues(a, b) from reka-ui/date; or Temporal.<Type>.compare(a, b) with the type of both values (Temporal.PlainDate.compare ignores the time of a PlainDateTime). Both return -1, 0 or 1, where v2 returned a difference: keep only sign tests (< 0, > 0, === 0) |
isSameDay(a, b) / isSameMonth(a, b) / isEqualDay(a, b) / isToday(value, tz) | isSameDay / isSameMonth / isSameDay / isToday from reka-ui/date |
startOfMonth / endOfMonth / startOfYear / endOfYear / startOfWeek(value, locale) / getDayOfWeek(value, locale) | the functions of the same names in reka-ui/date |
isWeekend(value, locale) | isWeekend(value, locale) from reka-ui/date |
value.timeZone / value.offset | value.timeZoneId / value.offsetNanoseconds / 1e6 |
value.toString() | unchanged for ISO dates; value.toString({ calendarName: 'never' }) (or toIsoString(value) from reka-ui/date) for the v2 string of a non-ISO date |
value instanceof CalendarDate (or any other class) | isPlainDate(value) / isPlainDateTime(value) / isZonedDateTime(value) / isPlainTime(value) from reka-ui/date |
isCalendarDateTime(value) from reka-ui/date | isPlainDateTime(value) (the old name still works but is deprecated) |
new DateFormatter(locale, options).format(value.toDate(tz)) | useDateFormatter(locale).custom(value, options), or value.toLocaleString(locale, options) |
- Install a Temporal polyfill if the project runs anywhere without native Temporal (most browsers today, Node before Temporal ships): add
temporal-polyfill-litetodependenciesand load it first in the app entry (main.ts, a Nuxt client plugin, the test setup file):tsUseimport { install } from 'temporal-polyfill-lite/shim' install(false)temporal-polyfill-lite/calendars-full/shimif the app uses a non-Gregorian calendar or a locale whose default calendar is not Gregorian (th,fa,ar-SA, …). Ask before adding it if the project already loads another Temporal polyfill (temporal-polyfill,@js-temporal/polyfill); keep that one instead. - Server rendering: the polyfill must load on the server too (an SSR entry or a universal Nuxt plugin).
- TypeScript: on TypeScript 6, make sure every
tsconfigthat type-checks app code hasESNext(orESNext.Temporal) inlib. Atsconfigextending@vue/tsconfig/tsconfig.dom.jsoninheritslib: ["ES2022", "DOM", "DOM.Iterable"]: setlibin it explicitly. WithskipLibCheck: true, a missing Temporal lib gives no error, onlyanydate types, so check thatDateValueis notany(for example,const x: DateValue = 42must fail). On TypeScript 5, addimport 'temporal-polyfill-lite/types/global'to a.d.tsfile instead, or ask about upgrading TypeScript. Do not add both. - Remove
@internationalized/datefrompackage.jsononce nothing imports it. Keep it if the app uses it for its own purposes and ask whether to migrate those uses. .yearon a value in a calendar with eras: replace with.eraYearwhere the code wants the year as displayed, and keep.yearwhere it does arithmetic. For a Gregorian/ISO date after year 0 they are equal.calendar.identifier === 'gregory'checks: also accept'iso8601', the calendar new values use..eracompared with a v2 era code: use the new code from What changed ('AD'→'ce', and for aniso8601value, which has no era, testvalue.year > 0). Text shown to users:formatter.part(value, 'era')instead of the code.<,>or===between date values: replace withcompareDateValues/equals.ref<CalendarDate>(…) as Ref<DateValue>casts: writeref<DateValue>(…)orshallowRef<DateValue>(…). Vue does not proxy Temporal values, so nomarkRawor.copy()is needed.- Templates cannot read the
Temporalglobal (Vue only exposes an allow-list of globals), so a v2 binding such as:min-value="new CalendarDate(2024, 1, 1)"becomes a constant created in<script setup>and bound by name. - Snapshots that print a date value: update them. Temporal values print as their ISO string.
Verify. The type-check passes with no Cannot find name 'Temporal' error. Nothing imports @internationalized/date (unless the developer chose to keep it). The app mounts in a browser without native Temporal, with no [Reka UI] The date components need the Temporal API error in the console. Each date component shows today's month and emits values of the type it was given. Tests pass after their setup file loads the polyfill.
Report
When you are done, give the developer:
- The list of files you changed, grouped by the section above that required the change.
- Every
active/inactiveselector, everyrequire(), every hand-built month or year switcher, every color model kept as a hex string, every gradient helper call, every prop read off a part ref, every other--scrollbar-widthuse, every overlay-less modal dialog, every form-input context assignment from section 17, every TagsInput / Editable handler from section 18, every app reliance on a re-press emit from section 19, every date or time field under a non-GregorianConfigProviderlocale and everyTimeFieldRootplaceholder handler from section 20, every count of duplicated tree selection entries orgoToSteponto a disabled step from section 21, every Splitter handler that ignores keyboard collapses, cancelled structural layout change orv-model:layoutsuggestion from section 22, everyNavigationMenuContentdouble-emit compensation or focus-onlyinteractOutsidehandler from section 23, every alias to a copy without per-component entry points from section 24, every transition on a part, hover-only transition and hand-written unmount delay from section 25, every shadow-root teleport target, document stylesheet for portalled content or shadow DOM workaround from section 27, every drawerupdate:openhandler that does more than cancel, hand-written tree selection workaround or select flag withoutmultiplefrom section 28, and every cancellingbeforeUpdate:modelValueon an uncontrolledAutocompleteRootfrom section 29, and every kept@internationalized/dateuse, existing Temporal polyfill or TypeScript 5 project from section 30 that you left unchanged because the rule said to ask, with file and line. - The result of the type-check, lint and test commands, compared with the baseline you recorded at the start.
