Skip to main content
skill CX Codex

floating-ui-vue-skilld — Claude Code skill: setup and features

floating-ui-vue-skilld guides AI coding agents on anchoring tooltips, popovers, and menus using @floating-ui/vue 2.0.1 in Vue 3.3+.

MIT 119 installs ★ 186 updated 2026-10-10

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add skilld-dev/vue-ecosystem-skills --skill floating-ui-vue-skilld -a claude-code
Open on GitHub

What floating-ui-vue-skilld does

The skill provides rules and best practices for integrating @floating-ui/vue 2.0.1. It covers useFloating, positioning styles via floatingStyles, reactive options, and core middleware like offset, flip, and shift.

Starting with version 2.0.0, the package dropped vue-demi and discontinued support for Vue 2 as well as Vue releases older than 3.3. Projects running earlier Vue setups must stay on @floating-ui/vue version 1.x.

When attaching whileElementsMounted: autoUpdate, always mount floating nodes with v-if. Rendering with v-show leaves scroll and resize listeners attached to hidden DOM elements, triggering listener leaks.

What it helps with

  • anchor tooltips and popovers with useFloating in Vue 3
  • configure flip, shift, and offset middleware for dynamic menus
  • prevent event listener leaks when using whileElementsMounted with autoUpdate
  • migrate component positioning logic from @floating-ui/vue 1.x to 2.0.1

Example prompts for the agent

  • Anchor a tooltip to a button with @floating-ui/vue and reposition on scroll
  • Set up useFloating with offset, flip, and an arrow ref in Vue 3.4
  • Migrate our popover component from @floating-ui/vue v1 to 2.0.1

How to install floating-ui-vue-skilld

1Skills CLI (Vercel)

npx skills add skilld-dev/vue-ecosystem-skills --skill floating-ui-vue-skilld -a claude-code

2Manually: put the files in place

~/.claude/skills/floating-ui-vue-skilld/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/floating-ui-vue-skilld/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about floating-ui-vue-skilld

How to install floating-ui-vue-skilld in Claude Code?

Run npx skills add skilld-dev/vue-ecosystem-skills --skill floating-ui-vue-skilld -a claude-code. This installs the skill file into ~/.claude/skills/floating-ui-vue-skilld/SKILL.md.

Which Vue versions does floating-ui-vue-skilld support?

It covers @floating-ui/vue 2.0.1, which requires Vue >=3.3.0. Vue 2 and earlier Vue 3 setups must pin version 1.x of @floating-ui/vue.

Why should floating elements use v-if instead of v-show with autoUpdate?

When using whileElementsMounted: autoUpdate, v-show keeps elements in the DOM and fails to unregister listeners on hide. v-if unmounts the element so cleanup runs properly.

Source text

SKILL.md · MIT
---
name: floating-ui-vue-skilld
description: "Floating UI for Vue (@floating-ui/[email protected]). ALWAYS use when writing code importing \"@floating-ui/vue\" or using useFloating, arrow, floatingStyles, or autoUpdate. Consult for middleware setup, anchoring, virtual elements, and v1 to v2 migration. Vue 3.3+ only."
license: MIT
---

# @floating-ui/vue 2.0.1

Vue 3 composable for anchor positioning. `useFloating()` computes `x`/`y` coordinates that place a floating element (tooltip, popover, menu) next to a reference element.

## Version limits

- Vue `>=3.3.0` only (peer dependency, `package.json:58`). v2.0.0 dropped the `vue-demi` layer, ending Vue 2 and Vue <3.3 support.
- Vue 2 or Vue <3.3 projects must stay on `npm install @floating-ui/vue@1` (https://floating-ui.com/docs/vue).
- Runtime dependencies: `@floating-ui/dom@^1.8.0`, `@floating-ui/utils@^0.2.12` (`package.json:46-49`).
- TypeScript with `exactOptionalPropertyTypes`: supported since v2.0.1 (optional properties are typed `T | undefined`, `dist/floating-ui.vue.d.ts:198-224`).

## Quick start

```vue
<script setup>
import {ref} from 'vue';
import {useFloating, offset, flip, shift, autoUpdate} from '@floating-ui/vue';

const reference = ref(null);
const floating = ref(null);
const open = ref(false);

const {floatingStyles, isPositioned} = useFloating(reference, floating, {
  open,
  middleware: [offset(10), flip(), shift()],
  whileElementsMounted: autoUpdate,
});
</script>

<template>
  <button ref="reference" @click="open = !open">Button</button>
  <div v-if="open" ref="floating" :style="floatingStyles">Tooltip</div>
</template>
```

Default placement is `bottom`; positioning uses `transform` by default (https://floating-ui.com/docs/vue).

## API changes since 1.x

- BREAKING (2.0.0): `vue-demi` removed. Vue 2 and Vue <3.3 no longer supported. No other breaking API changes; `useFloating`, `arrow`, and all re-exports keep their 1.1.x signatures (https://github.com/floating-ui/floating-ui/releases/tag/@floating-ui/[email protected]).
- FIX (2.0.1): optional `useFloating` options accept explicit `undefined` under `exactOptionalPropertyTypes` (https://github.com/floating-ui/floating-ui/releases/tag/@floating-ui/[email protected]).
- Unchanged behaviors carried from 1.x: `x`/`y` default to `0` (not `null`); `floatingStyles` returns ready-to-bind positioning styles; options accept refs and getters (`MaybeReadonlyRefOrGetter`) since 1.1.0 (verified in `dist/floating-ui.vue.d.ts:193-225`, `dist/floating-ui.vue.mjs:83-84`).

## Best practices

- Pass `whileElementsMounted: autoUpdate` so the floating element stays anchored during scroll, resize, and layout changes (`dist/floating-ui.vue.mjs:146-156`; https://floating-ui.com/docs/vue).
- When wrapping `autoUpdate` to pass options, always return the cleanup function (`dist/floating-ui.vue.mjs:140-145`):
```ts
useFloating(reference, floating, {
  whileElementsMounted(...args) {
    return autoUpdate(...args, {animationFrame: true});
  },
});
```
- Use `v-if` for the floating element when using `whileElementsMounted`. With `v-show`, skip `whileElementsMounted` and manage `autoUpdate` manually, or listeners leak on hidden elements (https://floating-ui.com/docs/vue).
- Pass an `open` ref and gate side effects on `isPositioned`; positioning resolves in a microtask, so the element sits at (0, 0) until then. `isPositioned` stays `false` while `open` is `false` (`dist/floating-ui.vue.mjs:137`, `dist/floating-ui.vue.mjs:157-161`):
```ts
const {isPositioned} = useFloating(reference, floating, {open});
watch(isPositioned, (positioned) => {
  if (positioned) inputRef.value?.focus();
});
```
- Pass refs or getters (`() => props.placement`) to `open`, `placement`, `strategy`, `middleware`, `transform` options for reactivity; they are watched with `flush: 'sync'` (`dist/floating-ui.vue.mjs:162-164`).
- Pass component template refs directly. Components are unwrapped via `$el`; a component that renders a comment node resolves to `null` and positioning safely no-ops (`dist/floating-ui.vue.mjs:6-15`).
- Keep the default `transform: true` and animate an inner wrapper element if you need CSS transform animations; the outer positioned node keeps `translate()` positioning (https://floating-ui.com/docs/vue).
- Use `arrow({element: arrowRef})` with a template ref. It no-ops (returns `{}`) until the arrow element mounts; read `middlewareData.arrow?.x/.y` for placement (`dist/floating-ui.vue.mjs:27-34`).

## Common tasks

- Arrow positioning example and full option defaults: [API reference](./references/api.md).
- Upgrading from 1.x or pinning for Vue 2: [Migration guide](./references/migration.md).

## Package exports

`useFloating`, `arrow`, plus re-exports from `@floating-ui/dom`: `autoPlacement`, `autoUpdate`, `computePosition`, `detectOverflow`, `flip`, `getOverflowAncestors`, `hide`, `inline`, `limitShift`, `offset`, `platform`, `shift`, `size` (`dist/floating-ui.vue.mjs:2`). Import middleware from `@floating-ui/vue`, not `@floating-ui/dom`, to keep the Vue-aware `arrow` behavior.

© skilld-dev · MIT · skilld-dev/vue-ecosystem-skills

Similar skills

All skills for Frontend and UI →

From the same set32

The whole set →
vueuse-shared-skilld vueuse-shared-skilld — a skill that brings @vueuse/shared v15.0.0 API reference into Claude Code, Cursor, and other editors. Covers reactive utilities: debounce, throttle, watch variants, state sharing, and ref synchronization for Vue 3. CX Codex +1 137installs tanstack-vue-virtual-skilld The tanstack-vue-virtual-skilld skill guides Vue work with @tanstack/vue-virtual, from implementing virtual lists to debugging adapter usage. It also covers window scrolling and chat feeds anchored at the end. CX Codex +1 129installs tanstack-vue-form-skilld tanstack-vue-form-skilld guides agents through writing, reviewing, and debugging Vue forms built with @tanstack/vue-form and its current API. CX Codex +1 125installs vueuse-math-skilld vueuse-math-skilld — a skill for @vueuse/math composables in Vue 3: clamp, project, round, and aggregate reactive numbers. CX Codex +1 119installs vue-data-ui-skilld The vue-data-ui-skilld skill guides agents working with the vue-data-ui Vue 3 chart library, from component selection and theming to SSR and debugging. CX Codex +1 118installs unovis-vue-skilld unovis-vue-skilld is a Claude Code skill for building and debugging Vue 3 code with @unovis/vue, including chart work and migration to API 1.7.0. CX Codex +1 112installs vitepress-skilld vitepress-skilld supplies API specs, config references, and CLI instructions for VitePress 1.6.4. CX Codex +1 110installs tanstack-ai-vue-skilld The tanstack-ai-vue-skilld skill guides Vue 3 work with @tanstack/ai-vue, covering streaming chat, media generation, reactive state, and typed client tools. CX Codex +1 110installs

Project sponsors

Companies that keep this analytics open