floating-ui-vue-skilld
Skill184 starsChanged 37 days agoMITView on GitHub
Floating UI for Vue (@floating-ui/vue@2.0.1). 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.
- Installs packages
In this repository35 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- formkit-core-skilldSkill
- motion-v-skilldSkill
- pinia-colada-skilldSkill
- pinia-skilldSkill
- primevue-skilldSkill
- quasar-skilldSkill
- reka-ui-skilldSkill
- shadcn-vue-skilldSkill
- slidev-cli-skilldSkill
- tanstack-ai-vue-skilldSkill
- tanstack-vue-form-skilldSkill
- tanstack-vue-query-skilldSkill
- tanstack-vue-router-skilldSkill
- tanstack-vue-store-skilldSkill
- tanstack-vue-table-skilldSkill
- tanstack-vue-virtual-skilldSkill
- tresjs-core-skilldSkill
- unhead-vue-skilldSkill
- unovis-ts-skilldSkill
- unovis-vue-skilldSkill
- vee-validate-skilldSkill
- vitepress-skilldSkill
- vue-data-ui-skilldSkill
- vue-i18n-skilldSkill
- vue-router-skilldSkill
- vue-skilldSkill
- vue-test-utils-skilldSkill
- vuetify-skilldSkill
- vueuse-components-skilldSkill
- vueuse-core-skilldSkill
- vueuse-integrations-skilldSkill
- vueuse-math-skilldSkill
- vueuse-motion-skilldSkill
- vueuse-shared-skilldSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 42
Default placement is bottom.
- Very specific: line 53
When wrapping autoUpdate to pass options, always return the cleanup function (dist/floating-ui.vue.mjs:140-145):
- Very specific: line 61
Use v-if for the floating element when using whileElementsMounted.
- Very specific: line 71
Keep the default transform: true and animate an inner wrapper element if you need CSS transform animations.
- Very specific: line 72
Use arrow({element: arrowRef}) with a template ref.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
@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.0only (peer dependency,package.json:58). v2.0.0 dropped thevue-demilayer, 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 typedT | undefined,dist/floating-ui.vue.d.ts:198-224).
Quick start
<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-demiremoved. 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/vue@2.0.0). - FIX (2.0.1): optional
useFloatingoptions accept explicitundefinedunderexactOptionalPropertyTypes(https://github.com/floating-ui/floating-ui/releases/tag/@floating-ui/vue@2.0.1). - Unchanged behaviors carried from 1.x:
x/ydefault to0(notnull);floatingStylesreturns ready-to-bind positioning styles; options accept refs and getters (MaybeReadonlyRefOrGetter) since 1.1.0 (verified indist/floating-ui.vue.d.ts:193-225,dist/floating-ui.vue.mjs:83-84).
Best practices
- Pass
whileElementsMounted: autoUpdateso 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
autoUpdateto pass options, always return the cleanup function (dist/floating-ui.vue.mjs:140-145):
useFloating(reference, floating, {
whileElementsMounted(...args) {
return autoUpdate(...args, {animationFrame: true});
},
});- Use
v-iffor the floating element when usingwhileElementsMounted. Withv-show, skipwhileElementsMountedand manageautoUpdatemanually, or listeners leak on hidden elements (https://floating-ui.com/docs/vue). - Pass an
openref and gate side effects onisPositioned; positioning resolves in a microtask, so the element sits at (0, 0) until then.isPositionedstaysfalsewhileopenisfalse(dist/floating-ui.vue.mjs:137,dist/floating-ui.vue.mjs:157-161):
const {isPositioned} = useFloating(reference, floating, {open});
watch(isPositioned, (positioned) => {
if (positioned) inputRef.value?.focus();
});- Pass refs or getters (
() => props.placement) toopen,placement,strategy,middleware,transformoptions for reactivity; they are watched withflush: '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 tonulland positioning safely no-ops (dist/floating-ui.vue.mjs:6-15). - Keep the default
transform: trueand animate an inner wrapper element if you need CSS transform animations; the outer positioned node keepstranslate()positioning (https://floating-ui.com/docs/vue). - Use
arrow({element: arrowRef})with a template ref. It no-ops (returns{}) until the arrow element mounts; readmiddlewareData.arrow?.x/.yfor placement (dist/floating-ui.vue.mjs:27-34).
Common tasks
- Arrow positioning example and full option defaults: API reference.
- Upgrading from 1.x or pinning for Vue 2: Migration guide.
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.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

