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

@lesetong/cardstack

v0.2.1

Published

Bidirectional, force-coupled card deck with spring gestures

Readme

@lesetong/cardstack

A fanned card deck with hover fan, spring swipe-to-flip and progress dots, built on motion. Available on npm.

Inspired by HyperOS 4

Features

  • Hover fan — cards 2/3 tilt out behind the front card with progressive blur
  • Bidirectional flip — drag up for the next card or down for the previous card; horizontal-only releases restore without changing the index
  • Force-coupled deck — vertical pulls give the second card a subtle same-direction follow; downward pulls also counterload the backmost card
  • Progress dots — white dot indicator on the right tracks your position in the deck
  • Controlled rolling — optionally animate parent-driven index jumps through every intermediate card
  • Configurable — per-card CardPose (tilt / origin / blur), size variant, radius
  • Fast — three cards at rest, with a short-lived maximum of five during overlapping gestures

Install

npm install @lesetong/cardstack
# or
pnpm add @lesetong/cardstack

Requires react and motion as peer dependencies.

import { CardStack } from '@lesetong/cardstack'
import '@lesetong/cardstack/style.css'

<CardStack
  cards={[<img src="a.jpg" alt="" />, <img src="b.jpg" alt="" />]}
  size="large"
  second={{ rotate: 6 }}
  third={{ rotate: -6, blur: 3 }}
/>

Controlled usage:

import { useState } from 'react'

const [index, setIndex] = useState(0)

<CardStack
  cards={cards}
  index={index}
  animateIndexChanges
  indexDirection="auto"
  onChange={setIndex}
/>

Passing index makes the component controlled. Parent-driven index changes synchronize immediately by default. Enable animateIndexChanges to roll through every intermediate card. indexDirection="auto" takes the shortest circular route; use "forward" or "backward" to force a route. Intermediate visual steps do not call onChange. Omit index for uncontrolled usage; use defaultIndex to choose the initial card.

Gestures

Drag up       → next card
Drag down     → previous card
Drag sideways → restore current card

The front card follows both axes, but only projected vertical movement changes the index. During vertical pulls, the visible second card follows the same x/y direction at a much smaller amplitude. A downward pull also keeps the backmost card in its original z-index and counterloads it. Releasing a committed backward gesture promotes the backmost card and returns the dragged card to the center as the new second slot.

Props

| Prop | Type | Default | Description | | --- | --- | --- | --- | | cards | ReactNode[] | — | Card contents, front to back | | index | number | — | Controlled front-card index (0-based) | | defaultIndex | number | 0 | Initial index for uncontrolled usage | | animateIndexChanges | boolean | false | Roll through intermediate cards when the parent changes index | | indexDirection | "auto" \| "forward" \| "backward" | "auto" | Route used for animated index changes; auto chooses the shortest circular path | | onChange | (index: number) => void | — | Called after a user gesture successfully flips a card | | size | "large" \| "small" | "large" | Variant (dimensions, origins, dots) | | width / height | number | per size | Deck size (px) | | radius | number | 14 / 12 | Card corner radius (px) | | second / third | CardPose | — | Pose overrides: { rotate?, origin?, blur? } |

Demo

Live Storybook: https://leset0ng.github.io/card-stack/

Dev

nub run dev              # storybook
nub run build            # library build
nub run typecheck        # tsc --noEmit
nub run build-storybook  # static docs site