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

next-client-utils

v1.2.4

Published

Essential utilities for Next.js projects (separate client/server exports)

Downloads

249

Readme

next-client-utils

🧩 Utilities to bridge server and client components seamlessly in Next.js apps.


✨ Features

  • 🖱️ Interactive popups: Trigger popups on click or hover for any element.
  • ⚛️ SSR-friendly: Keep elements server-side rendered while using WithPopup.
  • 🌐 Server-side popup rendering: Dynamically generate popup content via renderSSRPopUp.
  • 🎯 Customizable positioning: Fine-tune popup placement using flexible props.
  • 🪝 Essential React hooks: Includes useOutsideClick, useElementPositionChange, and more.
  • 🌀 Debounce utility: Built-in and fully customizable debounce mechanism.
  • 🧱 Column listing UI pattern: Automatically animates updated rows to the top—ideal for chat or feed-style interfaces.
  • Next.js-ready: Works out of the box with Server and Client Components.

🔍 What does it look like?

//  Server Component (module-1)
import { WithPopup } from 'next-client-utils';

export default function ServerComponent() {
  return (
    <WithPopup
      PopUp={PopUp}
      popupProps={{}} // Pass `{}` if your popup is typed as React.FC<{}>
      triggerType="hover" // Optional, defaults to "click"
    >
      <div>Open PopUp</div>
    </WithPopup>
  );
}


// Client Component (module-2)
'use client';

type PopUpProp={
   close?: () => void //  make sure you make it optional or else typescript will throw error.
}

const PopUp: React.FC<PopUpProp> = (props) => {
  // use props.close() to close modal
  return <div><p>This is PopUp</p>
   <button onClick={props.close?.()}>Close</button>
  </div>; // Style this as needed
};

🔍 Another Example?

// Server Component (module-1)
import { WithPopup } from 'next-client-utils';

export default function ServerComponent() {
  return (
    <WithPopup
      PopUp={ProfileDetailPopUp}
      popupProps={{
        firstName: "Prateek",
        lastName: "Sharma",
      }}
      gap={15} // Optional spacing between trigger and popup
      childrenWrapperComponent={UserName}
    >
      <>SSR Text</>
    </WithPopup>
  );
}


// Client Components (module-2)
'use client';

type ProfileDetailPopUpProps = {
  firstName: string;
  lastName: string;
};

const ProfileDetailPopUp: React.FC<ProfileDetailPopUpProps> = ({ firstName, lastName }) => {
  return <div>This is PopUp</div>; // Use props as needed
};

type UserNameProps = {
  isPopUpActive: boolean; // Provided automatically
  children: React.ReactNode;
};

const UserName: React.FC<UserNameProps> = ({ isPopUpActive, children }) => {
  // Use isPopUpActive to apply dynamic styles
  return <div>{children}</div>; // Receives 'SSR Text' as children
};

🧠 Example: Rendering a Server Component as a Popup

// Server Component (module-1)
import {WithPopup} from 'next-client-utils';

export default function ServerComponent(props: any) {
  // Define server-rendered popup via 'use server' function
  const renderSSRPopUp = async (popupProps: any) => {
    'use server';
    return <AnotherServerComponent {...popupProps} />;
  };

  return (
    <WithPopup
      renderSSRPopUp={renderSSRPopUp}
      popupProps={props} // Pass required props here
      triggerType="hover" // Optional
    >
      <div>Open PopUp</div>
    </WithPopup>
  );
}


// Another Server Component (module-2)

export default function AnotherServerComponent(props: any) {
  // Fetch data or perform server-side logic here
  return <div>This PopUp is server-rendered</div>;
}
npm install next-client-utils
# or
yarn add next-client-utils

🤝 Support

If you face any issues during integration or come across a bug, feel free to reach out to me on LinkedIn — happy to help!