Floating UI

React hooks and components for building accessible, perfectly positioned tooltips, popovers, and dropdowns.

Library
npm
v0.27.20
32,763 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
79 /100 Good
Development Activity 72
Maintenance 76
Community 68
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
85 /100 Excellent
Architecture 88
Code Quality 85
Innovation 87
Learning Curve 78

@floating-ui/react is the official React binding for Floating UI, the successor to Popper.js. It provides a low-level positioning hook, useFloating, alongside a full set of composable interaction hooks — useClick, useHover, useDismiss, useFocus, useRole, useListNavigation, and useTypeahead — that merge together via useInteractions to build accessible tooltips, popovers, dropdowns, select menus, and comboboxes.

Beyond raw positioning, the library solves the harder problems that come with floating UI: focus management, keyboard navigation, screen-reader semantics, portal rendering, nested floating trees for submenus, and safe-polygon hover-intent detection. It underpins a large share of the React ecosystem’s custom tooltip and popover implementations, from internal design systems to production component libraries.

What You Get

  • useFloating hook for anchoring a floating element to a reference element with automatic placement, flip, shift, and size middleware
  • A composable interaction system (useClick, useHover, useFocus, useDismiss, useRole, useListNavigation, useTypeahead) merged via useInteractions
  • Accessible building-block components: FloatingFocusManager, FloatingPortal, FloatingArrow, FloatingOverlay, and FloatingTree for nested menus
  • safePolygon for hover-intent detection between a reference and floating element, and FloatingDelayGroup for shared open/close delays across sibling triggers

Common Use Cases

  • Building a custom tooltip component with accurate arrow positioning and collision detection
  • Implementing an accessible dropdown or select menu with keyboard navigation and typeahead
  • Creating nested context menus or submenus using FloatingTree without losing focus and dismiss coordination
  • Adding a popover or combobox to a design system that needs to work inside scrollable or transformed containers

Under The Hood

Architecture - @floating-ui/react layers three concerns on top of the platform-agnostic @floating-ui/dom engine: positioning (useFloating in src/hooks/useFloating.ts wraps @floating-ui/react-dom’s useFloating and composes it with useFloatingRootContext.ts, which owns a shared FloatingContext object holding refs, position data, and interaction state), interaction composition (each of the hooks in src/hooks/ — useClick.ts, useHover.ts, useDismiss.ts, useRole.ts, useListNavigation.ts, useTypeahead.ts, useFocus.ts, useClientPoint.ts — returns a partial prop-getter object that useInteractions.ts merges into a single getReferenceProps/getFloatingProps/getItemProps pair), and accessible rendering (components in src/components/ — FloatingFocusManager.tsx for focus trapping, FloatingPortal.tsx for DOM portaling, FloatingTree.tsx/FocusGuard.tsx for nested-menu coordination via React context, and FloatingList.tsx for indexable item registries used by useListNavigation). The FloatingTree context is the key architectural device for correctness in nested UIs: submenus register as FloatingNode children so a dismiss or hover event on a child does not incorrectly close its ancestors.

Tech Stack - The package is TypeScript-first (TypeScript is 68.8% of the monorepo by bytes) and built with Rollup, emitting dual ESM/UMD bundles plus .d.ts and .d.mts type declarations distributed through package.json exports conditions for both the root API and a separate /utils subpath. It depends on @floating-ui/react-dom and @floating-ui/utils, both workspace-linked siblings in the pnpm monorepo, plus the small tabbable library for focus-order queries, and declares react/react-dom >=17 as peer dependencies so it stays framework-version-agnostic. Development uses Vite for the local test playground, Vitest (including a real-browser mode via vitest-browser-react) for unit tests, and Testing Library/user-event for interaction assertions; the whole repo is orchestrated with pnpm workspaces and Turborepo.

Code Quality - Test coverage is substantial: 22+ test files under packages/react/test/unit covering focus management, delay groups, node/tree registration, and each interaction hook, written with Testing Library idioms (render, fireEvent, userEvent) that exercise real DOM and focus behavior rather than shallow rendering. Source files are consistently typed with exported generic type parameters (e.g. useFloating<RT extends ReferenceType>), JSDoc comments link back to the public docs site (@see https://floating-ui.com/docs/useFloating), and naming is uniform across the hook/component split (useX for hooks, FloatingX for components). A shared ESLint config and tsconfig.base.json enforce consistency across all seven packages in the monorepo.

API Design - The API favors small, composable primitives over monolithic configuration objects: each interaction is its own hook returning prop-getter functions that useInteractions merges, so consumers opt into exactly the behaviors they need — a plain tooltip might use only useHover, useFocus, and useDismiss, while a combobox adds useListNavigation and useTypeahead. Getting started requires minimal boilerplate, since useFloating() alone returns refs and positioning styles, and the docs site plus in-source @see links keep the learning curve manageable despite the surface area. The one friction point is the number of hooks a complex component like a full combobox must wire together correctly, though FloatingTree and FloatingDelayGroup exist specifically to remove manual coordination for the hardest nested-UI cases.

Used by 82 apps in this directory

TypeScript
96%
MIT

Orca

AI Agents · AI Code Assistants

104,104

An open-source Agent Development Environment that orchestrates fleets of parallel AI coding agents — Claude Code, Codex, Gemini and more — each running in its own isolated git worktree.

View details
84
Repo Health
85
Technical
74
Dependency
Built with
TypeScript 96%
Updated 6 days ago
JavaScript
64%
AGPL 3.0

overleaf

Collaboration · Productivity

18,266

Open-source, real-time collaborative LaTeX editor with sandboxed compilation and full TeXLive support for self-hosted academic and research teams.

View details
84
Repo Health
80
Technical
59
Dependency
Built with
JavaScript 64%
TypeScript 30%
Updated 1 months ago
TypeScript
98%
AGPL 3.0

paseo

AI Agents · AI Code Assistants

21,830

One unified interface to orchestrate Claude Code, Codex, Copilot, OpenCode, and Pi agents in parallel from desktop, mobile, or the terminal.

View details
88
Repo Health
83
Technical
66
Dependency
Built with
TypeScript 98%
Updated 6 days ago
TypeScript
96%
MIT

Payload CMS

Blogging · CMS · Developer Tools

45,458

The open-source, Next.js-native headless CMS that lives inside your /app folder and gives you a full TypeScript backend instantly.

View details
92
Repo Health
88
Technical
65
Dependency
Built with
TypeScript 96%
Updated 6 days ago
TypeScript
67%
AGPL 3.0

Plane

Collaboration · Productivity · Project Management

61,353

Open-source project management platform to replace Jira, Linear, and ClickUp — with built-in cycles, real-time collaborative docs, and full self-hosting.

View details
92
Repo Health
82
Technical
77
Dependency
Built with
TypeScript 67%
Python 30%
Updated 1 weeks ago
TypeScript
67%
AGPL 3.0

Plane

Collaboration · Productivity · Project Management

61,353

Open-source project management platform to replace Jira, Linear, and ClickUp — with built-in cycles, real-time collaborative docs, and full self-hosting.

View details
92
Repo Health
82
Technical
77
Dependency
Built with
TypeScript 67%
Python 30%
Updated 1 weeks ago
Python
55%
Other

PostHog

Ab Testing Experimentation · Analytics · Developer Tools

40,397

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python 55%
TypeScript 36%
Updated 6 days ago
Go
68%
MIT

Probo

Automation · Security

1,476

Open-source GRC platform for engineering and security teams.

View details
87
Repo Health
90
Technical
69
Dependency
Built with
Go 68%
TypeScript 30%
Updated 1 weeks ago
Go
40%
Apache 2.0

Rill

Analytics · Data Engineering

2,962

The fastest BI tool for humans and agents — define metrics, models, and dashboards as code and query them instantly on ClickHouse or DuckDB.

View details
88
Repo Health
88
Technical
64
Dependency
Built with
Go 40%
TypeScript 38%
Svelte 21%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers