Skip to content
orbit logoOrbitUI
Floating positioning with lifecycle-owned geometry and middleware.
Version
v3.0.0
Size
4.5 KB gzip
Browser
autoUpdatecomputePositioncreatePositioner

Why Orbit? ​

Floating UI needs one owner for CSS coordinates, clipping boundaries, updates, and cleanup. Orbit provides a lifecycle positioner for normal UI and a pure computation API for advanced integrations.

ts
// Before
const { x, y } = computeSomehow(trigger, panel);
panel.style.left = `${x}px`;
panel.style.top = `${y}px`;

// After
const positioner = createPositioner(trigger, panel);
FeatureManual DOM positioningOrbit
Bundle size0 B4.5 KB
Root dependenciesApplication-defined@vielzeug/arsenal
Clipping boundaryManual geometryclippingAncestors default
Coordinate strategyConsumer logicfixed / absolute
CleanupManual listenersdispose()

Use Orbit when floating UI needs robust placement, collision handling, or reactive updates.

Consider direct CSS when placement is static and never depends on element geometry.

Installation ​

sh
pnpm add @vielzeug/orbit
sh
npm install @vielzeug/orbit
sh
yarn add @vielzeug/orbit

Quick Start ​

Create a positioner only after its reference and floating elements mount; positioning starts immediately.

ts
import { createPositioner, flip, offset, shift } from '@vielzeug/orbit';

const positioner = createPositioner(trigger, tooltip, {
  middleware: [offset(8), flip(), shift({ padding: 6 })],
  placement: 'top',
});

positioner.dispose();

Features ​

  • createPositioner() — Lifecycle-owned floating positioning
  • computePosition() — Low-level calculation for advanced integrations
  • autoUpdate() — Scroll, viewport, resize, and animation-frame updates
  • Middleware — Offset, flip, shift, size, hide, arrow, inline, auto-placement
  • strategy — Explicit fixed or absolute coordinate behavior
  • /reactive — Optional Ripple position readable

Documentation ​

See Also ​

  • Refine — Accessible components using floating UI behavior.
  • Ore — Lifecycle ownership for custom-element positioning.
  • Prism — Chart tooltips positioned from virtual references.