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
44%
Other

Magic

AI Agents · Automation · Low Code Platforms

5,055

Magic is an enterprise-grade open-source AI agent platform combining a generalist AI agent, workflow engine, IM, and collaborative office system for running an AI-powered digital workforce.

View details
68
Repo Health
79
Technical
65
Dependency
Built with
TypeScript 44%
PHP 32%
Updated 2 months ago
Ruby
59%
AGPL 3.0

Mastodon

Social Media

50,441

Run your own federated social network on the open ActivityPub standard with no ads, no algorithms, and no corporate control over your community.

View details
95
Repo Health
81
Technical
70
Dependency
Built with
Ruby 59%
TypeScript 24%
Updated 6 days ago
TypeScript
51%
Other

Mattermost

Collaboration · Devops · Team Chat

39,418

Open core, self-hosted team collaboration with chat, AI agents, voice calling, and deep DevOps integrations — all under your control.

View details
96
Repo Health
87
Technical
65
Dependency
Built with
TypeScript 51%
Go 40%
Updated 6 days ago
Clojure
57%
Other

Metabase

Analytics

49,827

The open-source BI platform that lets anyone ask questions and build dashboards without writing SQL — with an embedded analytics SDK and AI-powered query assistant included.

View details
95
Repo Health
84
Technical
62
Dependency
Built with
Clojure 57%
TypeScript 38%
Updated 6 days ago
Clojure
57%
Other

Metabase

Analytics

49,827

The open-source BI platform that lets anyone ask questions and build dashboards without writing SQL — with an embedded analytics SDK and AI-powered query assistant included.

View details
95
Repo Health
84
Technical
62
Dependency
Built with
Clojure 57%
TypeScript 38%
Updated 6 days ago
Go
56%
Other

Multica

AI Assistants · AI Development

53,682

Turn coding agents into real teammates — assign issues, track progress, and compound reusable skills across a vendor-neutral, self-hosted platform.

View details
87
Repo Health
83
Technical
67
Dependency
Built with
Go 56%
TypeScript 38%
Updated 6 days ago
TypeScript
65%
Other

NocoDB

Databases · Low Code Platforms · No Code Platforms

65,340

Turn any SQL database into a collaborative no-code spreadsheet with automatic REST APIs and real-time views.

View details
91
Repo Health
77
Technical
63
Dependency
Built with
TypeScript 65%
Vue 30%
Updated 6 days ago
Go
75%
Other

Notifuse

Marketing

2,256

Open-source, self-hosted alternative to Mailchimp, Brevo, and Klaviyo — send newsletters and transactional emails without per-email pricing or vendor lock-in.

View details
83
Repo Health
80
Technical
65
Dependency
Built with
Go 75%
TypeScript 22%
Updated 1 weeks ago
TypeScript
98%
Other

Novu

Developer Tools

40,195

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 98%
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