npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@aqualens/react

v3.0.1

Published

React bindings for @aqualens/core – A liquid glass effect components and hooks

Readme

@aqualens/react

React 18+ bindings for @aqualens/core: <Aqualens>, DOM and lens refs, and hooks backed by the shared renderer.

Live demo

Aqualens demo screenshot

Requirements

  • React and React DOM >= 18
  • WebGL2 (same as core)
  • html2canvas-propeer dependency; install it in your app for backdrop capture

Install

npm install @aqualens/react html2canvas-pro

@aqualens/core is a dependency of this package. html2canvas-pro must still be listed in your app because core declares it as a peer.

Quick start

"use client";

import { useState } from "react";
import { Aqualens } from "@aqualens/react";

export function HeroGlass() {
  const [backdrop, setBackdrop] = useState<HTMLDivElement | null>(null);

  return (
    <div ref={setBackdrop} className="relative">
      <img
        src="/bg.jpg"
        alt=""
        className="absolute inset-0 size-full object-cover"
      />

      {backdrop ? (
        <Aqualens
          snapshotTarget={backdrop}
          className="absolute left-1/2 top-1/2 w-72 -translate-x-1/2 -translate-y-1/2 rounded-3xl p-6 bg-white/20"
          refraction={{ thickness: 22, factor: 1.4 }}
          glare={{ factor: 35, range: 20 }}
          blurRadius={4}
        >
          <p>Content inside the glass</p>
        </Aqualens>
      ) : null}
    </div>
  );
}

snapshotTarget — subtree to capture as the refracted backdrop (often the same wrapper as your background). If omitted, the shared renderer uses document.body.

Use a semi-transparent background-color for tint and border-radius for the silhouette.

Props (high level)

| Prop | Description | | --- | --- | | snapshotTarget | Snapshot root: HTMLElement or null | | resolution | Capture scale 0.13.0 (default 2) | | refraction, glare | Same shapes as core (RefractionOptions, GlareOptions) | | blurRadius, blurEdge | Blur strength and edge clamping | | opaqueOverlap | When true, lenses at different stacking levels clip lower ones against the original snapshot | | powerSave | Use the lightweight power-save renderer instead of the full WebGL path | | onInit | (lens) => void when the lens is ready | | as | Polymorphic host element (default div) | | (also) | Standard HTMLAttributes for the host (except children typing) |

Refs

<Aqualens> supports two refs:

  • ref — host DOM node; type follows as (default HTMLDivElement)
  • lensRef — core AqualensLensInstance when ready, or null after unmount / mode change
import { useRef } from "react";
import { Aqualens, type AqualensLensInstance } from "@aqualens/react";

function Glass() {
  const elementRef = useRef<HTMLDivElement>(null);
  const lensRef = useRef<AqualensLensInstance | null>(null);

  return <Aqualens ref={elementRef} lensRef={lensRef} />;
}

Hooks

useAqualens()

Access the shared core renderer after it resolves:

import { useAqualens } from "@aqualens/react";

function Toolbar() {
  const { renderer, ready, recapture, registerDynamic } = useAqualens();

  return (
    <button type="button" disabled={!ready} onClick={() => void recapture()}>
      Refresh backdrop
    </button>
  );
}
  • recapture() — calls renderer.captureSnapshot() when the shared instance exists
  • registerDynamic(el) — forwards to addDynamicElement

useDynamicElement<T>()

Ref that registers its node with the shared renderer when mounted:

const motionRef = useDynamicElement<HTMLDivElement>();
return <div ref={motionRef}>…</div>;

Re-exported core API

You can import advanced helpers and types from @aqualens/react or @aqualens/core, for example:

AqualensRenderer, getSharedRenderer, updateSharedRendererConfig, setOpaqueOverlap, DEFAULT_OPTIONS, and the main TypeScript types.

Reveal attributes in React markup

Configure reveal layers on children with data attributes:

<Aqualens className="indicator" style={{ zIndex: 10 }}>
  <span
    data-aqualens-reveal-index={11}
    data-aqualens-reveal-mode="on-lens"
    className="text-red-500"
  >
    Genres
  </span>
</Aqualens>
  • data-aqualens-reveal-index — numeric threshold (required for reveal logic)
  • data-aqualens-reveal-mode — optional; under-lens (default) vs on-lens (above tint within the lens shape, with that lens refraction applied)

See packages/core/README.md for HTML examples and behaviour detail.

Example project

Hosted demo: famence.github.io/aqualens.

The demo/ Next.js app in this repo includes controls and toggles (opaqueOverlap, powerSave, and more)—use it as an integration reference.

Scripts

npm run build
npm run typecheck

License

MIT