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

butter-modal

v1.0.7

Published

A smoothly animated modal for React

Readme

🧈 ButterModal

A smoothly animated multi-step modal component for React. Built on top of Radix UI's Dialog primitive and Framer Motion.

Features

  • Animated height transitions — the modal smoothly resizes as content changes between steps
  • Spring-based content transitions — each step scales and fades in/out with a subtle spring animation (95% → 100%)
  • Fully customizable — control theme colors, border radius, padding, and overlay styles via props

Installation

npm i butter-modal

Quick Start

Define your modal steps as an array of ModalState objects - each with a unique key and a content node. Pass this array to the states prop along with your open state and step state.

ButterModal will automatically animate between content frames as the step changes, smoothly resizing the modal container to fit the new content height.

import { useState } from 'react';
import { ButterModal } from 'butter-modal';

function App() {
  const [open, setOpen] = useState(false);
  const [step, setStep] = useState('welcome');

  const handleClose = () => {
    setOpen(false);
    setStep('welcome');
  };

  const states = [
    {
      key: 'welcome',
      content: (
        <div>
          <h2>Welcome</h2>
          <p>This is step one.</p>
          <button onClick={() => setStep('details')}>Next</button>
        </div>
      ),
    },
    {
      key: 'details',
      content: (
        <div>
          <h2>Details</h2>
          <p>This is step two with more content.</p>
          <button onClick={() => setStep('welcome')}>Back</button>
          <button onClick={handleClose}>Done</button>
        </div>
      ),
    },
  ];

  return (
    <>
      <button onClick={() => setOpen(true)}>Open Modal</button>
      <ButterModal
        states={states}
        step={step}
        onStepChange={setStep}
        initialStep="welcome"
        open={open}
        onOpenChange={setOpen}
        onClose={handleClose}
        theme={{
          background: '#ffffff',
          border: 'transparent',
          text: '#111111',
          overlay: '#000000',
        }}
        containerStyle={{ padding: 12 }}
        contentStyle={{ borderRadius: 20 }}
      />
    </>
  );
}

Children Render Prop

The children render prop gives you access to the current step, a setStep function, and a close function.

<ButterModal
  states={states}
  step={step}
  onStepChange={setStep}
  initialStep="default"
  open={open}
  onOpenChange={setOpen}
  onClose={handleClose}
>
  {({ step, setStep, close }) => (
    <div>
      <button onClick={close}>Done</button>
    </div>
  )}
</ButterModal>

Props

| Prop | Type | Description | |------|------|-------------| | states | ModalState[] | Array of step objects, each with a key and content | | initialStep | ModalStep | The key of the initial step to display | | step | ModalStep | The currently active step key (controlled) | | onStepChange | (step: ModalStep) => void | Callback fired when the step should change | | open | boolean | Whether the modal is open | | onOpenChange | (open: boolean) => void | Callback fired when open state changes | | onClose | () => void | Callback fired when the modal closes | | trigger | React.ReactNode | Optional trigger element to open the modal | | overlayStyle | React.CSSProperties | Custom styles for the backdrop overlay | | contentStyle | React.CSSProperties | Custom styles for the modal content container | | containerStyle | React.CSSProperties | Custom styles for the inner padding container | | theme | ButterModalTheme | Theme object for colors (see below) | | children | ({ step, setStep, close }) => React.ReactNode | Render prop for persistent navigation controls |

ButterModalTheme

type ButterModalTheme = {
  background?: string;  // Modal background color
  border?: string;      // Modal border color
  text?: string;        // Default text color
  overlay?: string;     // Backdrop overlay color
};

Built With


More love for the web by Arnav Nath