Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/docs-plus/docs.plusWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/docs-plus/docs.plus/react-floating-ui)<a href="https://agentmods.dev/rules/docs-plus/docs.plus/react-floating-ui"><img src="https://agentmods.dev/badge/rules/docs-plus/docs.plus/react-floating-ui/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/docs-plus/docs.plus/react-floating-ui"><img src="https://agentmods.dev/badge/rules/docs-plus/docs.plus/react-floating-ui.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.02008 |
| Opus 5.5 | $0.00000 | $0.00803 |
| Sonnet 5.5 | $0.00000 | $0.00402 |
| Haiku 4.5 | $0.00000 | $0.00201 |
Grade A, and why
react-floating-ui scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 269 lines — stays where its author put it; the contents beside it link to each section on GitHub.
React 19 + Floating UI — Project Conventions & Pitfalls
This project uses React 19.2, @floating-ui/react 0.27, daisyUI 5, and Tailwind CSS 4.
1. React 19: ref Is a Regular Prop (CRITICAL)
In React 19, ref moved from a special element field into element.props.ref.
This breaks the common cloneElement + spread pattern silently.
The Bug
// ❌ BROKEN in React 19 — child.props.ref overwrites our ref
cloneElement(child, {
ref: ourMergedRef, // set first...
...child.props // ...overwritten by child.props.ref!
})
The Fix
// ✅ CORRECT — strip ref, place merged ref LAST
const { ref: _, ...propsWithoutRef } = child.props ?? {}
cloneElement(child, getReferenceProps({
...propsWithoutRef,
ref: mergedRef // MUST come last to take precedence
}))
Reading a Child's Ref (React 18 + 19 compatible)
// Read from both locations for cross-version compatibility
const childRef = isValidElement(children)
? (children as any).props?.ref ?? (children as any).ref ?? null
: null
Where This Applies
Tooltip.tsx— wraps arbitrary children viacloneElementPopover.tsx—PopoverTrigger asChildusescloneElement- Any component using
cloneElementwithuseMergeRefs
2. Floating UI: Use Built-in Interaction Hooks
Rule
NEVER reinvent hover/click/focus with manual useState + setTimeout.
ALWAYS use Floating UI's interaction hooks.
| Interaction | Hook | Example |
|---|---|---|
| Hover | useHover(context, opts) |
Tooltip, HoverMenu |
| Click | useClick(context, opts) |
Popover, Select |
| Dismiss | useDismiss(context) |
All floating components |
| Role | useRole(context, { role }) |
All (a11y) |
| Focus | useFocus(context) |
Tooltip (keyboard a11y) |
Why
Manual hover state management bypasses Floating UI's onOpenChange flow.
This causes useDismiss, whileElementsMounted, and position calculation to be disconnected from the actual open state.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago Changed e4f9bbda9b80
- 10d ago Changed · +1 lines beacd1ef9ba0
- 1mo ago First seen · 268 lines · 0 tokens per session scan A 5355c412f6de
react-floating-ui is a cursor rule published in the GitHub repository docs-plus/docs.plus (95 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,008 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
windsurfrules
Create detailed components with these requirements.
tanstack-start-guide
TanStack Start best practices emphasizing client-first architecture, type safety, and modern React patterns.
new-component
Workflow for creating new React components.
tanstack-react-router_routing
TanStack Router: Routing.
project-structure
Folder layout for Next.js App Router and Vite + React variants.
rendering-and-memoization
React anti-patterns R9, R11, R12 — index-as-key in dynamic lists, context overuse for frequent updates, inline functions breaking memoization. Load on a review hit for any of these codes, or when tuning render performance.