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

components-kits

v1.3.1

Published

A lightweight, reusable React component library for modern apps.

Readme

components-kits

A lightweight utility component library for modern React applications. Designed to handle repetitive UI patterns declaratively.

Installation

npm install components-kits
# or
pnpm add components-kits

Peer Dependencies

  • react ^18 || ^19
  • react-dom ^18 || ^19

Components

List

A generic list component for declarative array rendering.

import { List } from 'components-kits';

const fruits = ['Apple', 'Banana', 'Cherry'];

<List
  items={fruits}
  render={(item) => <span>{item}</span>}
/>;

Props

| Prop | Type | Required | Description | | -------------- | ---------------------------------------------- | -------- | ---------------------------------------------- | | items | T[] | - | Array data to render | | render | (item: T, index: number) => ReactNode | Yes | Render function for each item | | keyExtractor | (item: T, index: number) => string \| number | - | Function to extract a unique key for each item | | direction | 'row' \| 'column' | - | List direction (default: 'column') | | liProps | ComponentProps<'li'> | - | Props passed to each <li> element | | className | string | - | Class name added to the <ul> element |

All standard HTML attributes for <ul> are also supported.

Object Array Example

const users = [
  { id: 1, name: 'Alice' },
  { id: 2, name: 'Bob' },
];

<List
  items={users}
  render={(user) => <span>{user.name}</span>}
  keyExtractor={(user) => user.id}
  direction='row'
/>;

VisibleGuard

A component for declarative conditional rendering. Replaces ternary operators and && patterns with a more expressive approach.

import { VisibleGuard } from 'components-kits';

<VisibleGuard isVisible={isLoggedIn}>
  <Dashboard />
</VisibleGuard>;

Props

| Prop | Type | Required | Description | | ----------- | ----------- | -------- | ------------------------------------------------------------------ | | isVisible | boolean | Yes | Renders children when true | | fallback | ReactNode | - | Element to render when isVisible is false (default: null) | | children | ReactNode | - | Content to render when the condition is met |

Fallback Example

<VisibleGuard
  isVisible={isLoaded}
  fallback={<Spinner />}
>
  <Content />
</VisibleGuard>

SwitchCase

A component for declarative value-based conditional rendering. Replaces ternary chaining and if/else blocks with a JSX-native switch/case.

import { SwitchCase } from 'components-kits';

<SwitchCase
  value={status}
  cases={{
    loading: <Spinner />,
    error: <ErrorMessage />,
    success: <Content />,
  }}
  defaultCase={<Empty />}
/>

Props

| Prop | Type | Required | Description | | ------------- | --------------------------------------- | -------- | -------------------------------------------------------- | | value | string \| number | Yes | Value to match against | | cases | Record<string \| number, ReactNode> | Yes | Map of values to rendered content | | defaultCase | ReactNode | - | Element to render when no case matches (default: null) |


Portal

A createPortal wrapper component. Renders children into a specified DOM node.

import { Portal } from 'components-kits';

<Portal container="#modal-root">
  <Dialog />
</Portal>

Props

| Prop | Type | Required | Description | | ----------- | -------------------- | -------- | --------------------------------------------------------- | | container | Element \| string | - | DOM element or CSS selector (default: document.body) | | children | ReactNode | - | Content to render through the portal |

  • SSR-safe (renders only after mount)
  • Renders nothing if the selector does not match any element

InfiniteList

An IntersectionObserver-based infinite scroll list component. Places a sentinel element at the bottom of the list and triggers a callback when it enters the viewport.

import { InfiniteList } from 'components-kits';

<InfiniteList
  items={data}
  render={(item) => <Card {...item} />}
  keyExtractor={(item) => item.id}
  onIntersect={fetchNextPage}
  enabled={hasNextPage}
  observerOptions={{ rootMargin: '200px' }}
/>

Props

| Prop | Type | Required | Description | | ----------------- | ---------------------------------------------- | -------- | ---------------------------------------------------- | | items | T[] | - | Array data to render | | render | (item: T, index: number) => ReactNode | Yes | Render function for each item | | keyExtractor | (item: T, index: number) => string \| number | - | Function to extract a unique key for each item | | liProps | ComponentProps<'li'> | - | Props passed to each <li> element | | onIntersect | () => void | Yes | Callback fired when sentinel enters the viewport | | enabled | boolean | - | Disables the observer when false (default: true) | | observerOptions | IntersectionObserverInit | - | root, rootMargin, threshold observer options |

All standard HTML attributes for <ul> are also supported.

  • The sentinel <div> is only rendered when items has at least one item and enabled is true
  • Set enabled={false} once all data has been loaded to deactivate the observer

License

MIT