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

@rare-lab/react

v1.0.0

Published

React component for embedding Rare.lab visual effects

Readme

@rare-lab/react

React component for embedding Rare.lab visual effects into any React application. Drop a single component into your app and get production-ready WebGL shader effects — no build configuration, no Three.js dependency, no runtime overhead.

Install

npm install @rare-lab/react

Requirements: React 18 or later.

Quick Start

import { RareScene } from '@rare-lab/react'

export default function Hero() {
  return (
    <div style={{ width: '100%', height: '100vh' }}>
      <RareScene sceneId="your-scene-id" />
    </div>
  )
}

The sceneId is the ID you get after publishing a scene in the Rare.lab editor.

Usage with Next.js

<RareScene> includes 'use client' — it works in both App Router and Pages Router without extra configuration.

// app/page.tsx
import { RareScene } from '@rare-lab/react'

export default function Page() {
  return (
    <section className="hero">
      <RareScene
        sceneId="your-scene-id"
        width="100%"
        height="100vh"
        hoverReactive
      />
    </section>
  )
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | sceneId | string | (required) | Published scene ID from the Rare.lab editor | | width | number \| string | '100%' | Container width. Numbers are treated as pixels. | | height | number \| string | '100%' | Container height. Numbers are treated as pixels. | | className | string | — | CSS class name on the container div | | style | CSSProperties | — | Additional inline styles on the container div | | poster | string | — | Image URL shown while the scene loads | | scrollDriven | boolean | false | Enable scroll-driven animation | | hoverReactive | boolean | false | Enable mouse/hover reactivity | | state | string | — | Set the interaction state machine state | | ariaLabel | string | 'Animated visual effect' | Accessible label for screen readers | | cdnBase | string | Rare.lab CDN | Override the CDN base URL (advanced) | | onLoad | (detail: { sceneId: string }) => void | — | Called when the scene finishes loading | | onError | (error: { code: string; message: string; sceneId?: string }) => void | — | Called on any runtime error |

Interactivity

Scenes built with interaction nodes in the Rare.lab editor respond to user input automatically. Enable the relevant prop to activate each interaction type:

// Mouse-reactive background
<RareScene sceneId="..." hoverReactive />

// Scroll-driven animation
<RareScene sceneId="..." scrollDriven />

// Programmatic state control
<RareScene sceneId="..." state="active" />

Callbacks

<RareScene
  sceneId="your-scene-id"
  onLoad={({ sceneId }) => {
    console.log(`Scene ${sceneId} loaded`)
  }}
  onError={({ code, message }) => {
    console.error(`Scene error [${code}]: ${message}`)
  }}
/>

Accessibility

The component renders with role="img" and a configurable aria-label. It respects prefers-reduced-motion — when the user's OS is set to reduce motion, the scene displays a static poster image instead of animating.

How It Works

The component loads the Rare.lab runtime (rare.min.js) from the CDN once, then renders your published scene as a <rare-scene> web component inside a container div. The runtime is shared across all <RareScene> instances on the page — multiple scenes don't load the script twice.

Scenes that use 3D mesh nodes automatically lazy-load the 3D renderer chunk. Scenes that only use 2D effects never download it.

License

MIT