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

@prass/betterimage

v1.0.4

Published

BetterImage is a Next.js-focused library for building optimized image components with advanced features, including fallback animations. It enhances Next.js's built-in Image component, offering seamless optimization and an improved user experience for your

Readme

BetterImage

BetterImage is a Next.js-focused library for building optimized image components with advanced features, including fallback animations. It enhances Next.js's built-in Image component, offering seamless optimization and an improved user experience for your projects.

Features

  • Next.js Image Optimization: Leverages Next.js's Image component for automatic optimizations like lazy loading, responsive resizing, and image format selection.
  • Fallback Animations: Provides smooth loading animations and error handling for images that fail to load.
  • Enhanced Customization: Offers flexibility for customization, making it easy to adapt to your design system.
  • Prebuilt Component: Quickly integrate the BetterImage component into your project for consistent and optimized image handling.

Installation

Install betterimage using npm or yarn:

npm install @prass/betterimage
# or
yarn add @prass/betterimage

Usage

BetterImage is designed for Next.js projects. Simply replace the Next.js Image component with the BetterImage component.

Pre-built Component

import { BetterImage } from "@prass/betterimage/components";

export default function Example() {
  return (
    <BetterImage
      src="https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&cs=tinysrgb&w=600"
      alt="Example Image"
      width={600}
      height={900}
      onFailString="Example Image"
    />
  );
}

Component Props

BetterImage extends the Next.js Image component and includes additional props:

| Prop | Type | Description | | -------------- | --------------- | ---------------------------------------------------------------------------- | | onFailString | string | Fallback string to display if the image fails to load. | | delay | number | Delay rendering for users with slower connections, to improve performance. | | Other Props | ...ImageProps | All standard Next.js Image props are supported (e.g., src, alt, width, etc.) |

Build Your Own Components

BetterImage is highly customizable. You can create your own components based on your project needs.

import * as BetterThings from "@prass/betterimage";
import { pras } from "@prass/betterimage/lib";

const BetterVersion = React.forwardRef(({ className, ...props }, ref) => (
  <BetterThings.Root
    ref={ref}
    className={pras("relative flex h-full w-full", className)}
    {...props}
  />
));

BetterVersion.displayName = BetterThings.Root.displayName;

const Img = React.forwardRef(({ className, ...props }, ref) => (
  <BetterThings.Image
    ref={ref}
    className={pras("h-full w-full", className)}
    {...props}
  />
));

Img.displayName = BetterThings.Image.displayName;

const Fallback = React.forwardRef(({ className, ...props }, ref) => (
  <BetterThings.Fallback
    ref={ref}
    className={pras(
      "flex h-full w-full items-center justify-center",
      className
    )}
    {...props}
  >
    <Loader className="h-4 w-4 animate-spin" />
  </BetterThings.Fallback>
));

Fallback.displayName = BetterThings.Fallback.displayName;

export { BetterVersion, Img, Fallback };

Why Choose BetterImage?

BetterImage simplifies image handling in your Next.js projects with:

  • Extended API: Enhances Next.js Image with fallback animations and optimization features.
  • Built-in Fallbacks: Automatically handles image loading and error states.
  • Fast Development: Prebuilt components help you integrate optimized images quickly and maintain consistency.

Limitations

  • Next.js Only: This package is designed exclusively for Next.js. It is not compatible with other frameworks or libraries like React without Next.js.

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! If you find any bugs or have suggestions, feel free to open an issue or submit a pull request.


Elevate your Next.js image components with BetterImage! 🚀