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

v1.1.0

Published

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

Downloads

608

Readme

@aqualens/react

React 18+ bindings for @aqualens/core: a declarative <Aqualens> wrapper, refs, and hooks on top of the shared WebGL renderer.

Live demo

Aqualens demo screenshot

Requirements

  • React and React DOM >= 18
  • Same browser requirements as core: WebGL2
  • html2canvas-pro — peer dependency (required for backdrop capture; install it in your app)

Install

npm install @aqualens/react html2canvas-pro

@aqualens/core is installed as a dependency of this package. You still need html2canvas-pro in your project because it is a peer dependency of @aqualens/core (and of @aqualens/react).

Quick start

"use client"; // Next.js App Router — effect needs the client

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

export function HeroGlass() {
  return (
    <div className="relative" id="backdrop">
      {/* Background content to refract */}
      <img
        src="/bg.jpg"
        alt=""
        className="absolute inset-0 size-full object-cover"
      />

      <Aqualens
        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>
    </div>
  );
}
  • snapshotTarget: root element whose subtree is captured as the refracted backdrop (often the same wrapper as your background). If omitted, the shared renderer falls back to document.body.
  • style / className: use a semi-transparent background-color so the library can infer tint; border-radius defines the glass shape.

Props (high level)

| Prop | Description | | --- | --- | | snapshotTarget | Snapshot root: HTMLElement or null. | | resolution | 0.13.0, default 2 — internal capture scale. | | refraction, glare | Same shapes as core (RefractionOptions, GlareOptions). | | blurRadius, blurEdge | Blur strength and edge clamping. | | opaqueOverlap | macOS-style stacking when lenses use different z-index. | | powerSave | Use lightweight non-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). |

Ref

import { useRef } from "react";
import { Aqualens, type AqualensRef } from "@aqualens/react";

const ref = useRef<AqualensRef>(null);
// ref.current?.lens — AqualensLensInstance
// ref.current?.element — host DOM node

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()renderer.captureSnapshot() when the shared instance exists.
  • registerDynamic(el) — forwards to addDynamicElement for moving/updating regions.

useDynamicElement<T>()

Returns a ref that registers its node with the shared renderer when ready (convenience over registerDynamic).

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

Re-exported core API

For advanced usage you can import from @aqualens/react or @aqualens/core interchangeably for types and helpers, for example:

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

Example project

The interactive demo runs at famence.github.io/aqualens.
The monorepo demo app (demo/ at the repository root) shows controls, opaqueOverlap, and powerSave toggles — use it as a full integration reference.

Scripts (monorepo / package root)

npm run build
npm run typecheck

License

MIT