Migration guide: @floating-ui/vue 1.x to 2.x
v2.0.0 (breaking)
Dropped the abandoned vue-demi package, ending support for Vue 2 and Vue <3.3.0.
- Source: https://github.com/floating-ui/floating-ui/releases/tag/@floating-ui/vue@2.0.0
- Effect in the prepared source:
vueis imported directly instead ofvue-demi(dist/floating-ui.vue.mjs:4); peer dependency isvue: ">=3.3.0"(package.json:58). - Required action:
- If the project uses Vue >=3.3.0, no code changes.
useFloatingandarrowsignatures, options, defaults, and return values are unchanged from 1.1.x (comparedist/floating-ui.vue.d.ts:191-266with the 1.x API). - If the project uses Vue 2 or Vue <3.3.0, either upgrade Vue or stay on the v1 line:
npm install @floating-ui/vue@1(https://floating-ui.com/docs/vue).
- If the project uses Vue >=3.3.0, no code changes.
- Remove
vue-demifrom your dependencies if you installed it only for this package. v2 never reads it. - If you used
@floating-ui/vuewithvue-demi's Vue 2 mode (e.g.isVue2branches), port those branches to a Vue 3 project or keep the v1 line.
v2.0.1 (patch)
- Supports explicit
undefinedfor optional properties when the project compiles with TypeScriptexactOptionalPropertyTypes. Options are typedMaybeReadonlyRefOrGetter<T | undefined> | undefined(dist/floating-ui.vue.d.ts:198-224). - Updated dependencies:
@floating-ui/dom@1.8.0,@floating-ui/utils@0.2.12(package.json:46-49). - Source: https://github.com/floating-ui/floating-ui/releases/tag/@floating-ui/vue@2.0.1
Earlier changes still relevant when jumping from pre-1.0
- 1.0.0:
xandydefault to0instead ofnull. Check readiness withisPositioned, not coordinate null checks (dist/floating-ui.vue.mjs:83-84; https://github.com/floating-ui/floating-ui/releases/tag/@floating-ui/vue@1.0.0). - 1.0.0:
floatingStylesintroduced; bind it to the floating element's:style(https://github.com/floating-ui/floating-ui/releases/tag/@floating-ui/vue@1.0.0). - 1.1.0:
useFloatingoptions accept refs and getters (MaybeReadonlyRefOrGetter), e.g.placement: () => props.placement(dist/floating-ui.vue.d.ts:138; https://github.com/floating-ui/floating-ui/releases/tag/@floating-ui/vue@1.1.0). - 1.1.5:
isPositionedis not set totruewhileopenisfalse(dist/floating-ui.vue.mjs:137; https://github.com/floating-ui/floating-ui/releases/tag/@floating-ui/vue@1.1.5).
Upgrade checklist
- Confirm Vue version:
node -e "console.log(require('vue/package.json').version)". Must be >=3.3.0. - Update the dependency:
npm install @floating-ui/vue@^2.0.1(or the pnpm/yarn equivalent). - Remove
vue-demiif present:npm uninstall vue-demi. - If TypeScript uses
exactOptionalPropertyTypes, no workaround is needed on 2.0.1+. - Run typecheck and tests. No runtime API changed between 1.1.x and 2.0.1.