r/reactjs • • Nov 03 '26

Show /r/reactjs Fluid Kit: iOS 26-style interactions for React (glass, morphs, context menus, sheets, layout animations)

Fluid Kit is a set of interactions modeled on iOS 26: Liquid Glass, morphs between elements, long-press context menus, draggable sheets, a highlight that follows the pointer, and layout animations. 2.0 just shipped as one package per framework, so for React it's @fluidkit/react.

The React API is compound components, with a render prop as in Base UI:

import "@fluidkit/react/style.css";
import { Lift } from "@fluidkit/react";

<Lift.Root onSelect={(value) => act(value)}>
  <Lift.Target render={<img src={src} alt="" />} />
  <Lift.Menu className="menu lb">
    <Lift.Item value="copy">Copy</Lift.Item>
    <Lift.Item value="share">Share</Lift.Item>
  </Lift.Menu>
</Lift.Root>

Every part also has a hook (useLift(), useDrag(), useLayout()…) for markup of your own. State is controlled or uncontrolled (open/defaultOpen/onOpenChange and friends), components are "use client" and render plain markup on the server, React 18+.

Under the hood each feature is a headless engine on springs that keep their velocity when interrupted, so you can reverse a morph or catch a sheet mid-flight.

Docs with React examples: https://fluidkit.mogilnikov.dev

GitHub: https://github.com/mikhailmogilnikov/fluid-kit

1 Upvotes

2 comments sorted by

1

u/[deleted] Nov 03 '26

[removed] — view removed comment

1

u/Mysterious-Lie1437 29d ago

Thanks! Mid-drag nothing re-renders: the engine writes the position straight to the element's translate every frame. If you want the frames, there's onMove(position, velocity), a plain callback, e.g. to fade a backdrop with the sheet. State only changes at the edges: dragging on grab and release, and snap once on release, as soon as it knows which snap point it's heading for, before the spring lands. If you control snap and don't take the new value, it springs back to yours.

On size, you caught a real bug. Until now `import { Drag } from "@fluidkit/react"` pulled in ~28 KB gzipped, because bundlers couldn't tell the other components were side-effect free and kept them all. Fixed in 2.0.1: Drag alone is now ~7 KB gzipped (the bare engine, createDrag from @/fluidkit/core, is ~5 KB). A sheet needs no CSS; style.css is the glass and the CSS springs.