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

bechbox-ui

v1.0.50

Published

Small basic component library

Readme

bechbox-ui component library

This is the bechbox-ui component library. A simple component library with basic components with a little twist: Button with animations and Text with transitions etc.

Usage

Visit https://ui.bechbox.com/ to learn more about the components and how to install and use.

Themes

bechbox-ui supports both light and dark themes. You can use themes in two ways: with the ThemeProvider component (recommended) or by manually setting the theme attribute.

Using ThemeProvider (Recommended)

The ThemeProvider component manages theme state, persists the user's preference to localStorage, and automatically applies the theme to your application.

Basic Setup

import { ThemeProvider, Button, useTheme } from "bechbox-ui";

function App() {
  return (
    <ThemeProvider defaultTheme="light">
      <YourAppContent />
    </ThemeProvider>
  );
}

Theme Toggle Example

import { ThemeProvider, useTheme, Button } from "bechbox-ui";

function ThemeToggle() {
  const { theme, toggleTheme } = useTheme();
  
  return (
    <Button onClick={toggleTheme}>
      Switch to {theme === "light" ? "dark" : "light"} mode
    </Button>
  );
}

function App() {
  return (
    <ThemeProvider defaultTheme="light">
      <ThemeToggle />
      {/* Rest of your app */}
    </ThemeProvider>
  );
}

ThemeProvider Props

  • defaultTheme?: "light" | "dark" - The default theme to use (defaults to "light")
  • storageKey?: string - The localStorage key to store the theme preference (defaults to "bechbox-ui-theme")
  • children: React.ReactNode - Your application content

useTheme Hook

The useTheme hook provides access to the current theme and theme control functions:

const { theme, setTheme, toggleTheme } = useTheme();

// theme: "light" | "dark" - Current theme
// setTheme: (theme: "light" | "dark") => void - Set theme directly
// toggleTheme: () => void - Toggle between light and dark

Note: useTheme must be used within a ThemeProvider. If used outside, it will throw an error.

Manual Theme Switching (Without ThemeProvider)

You can also control themes manually by setting the data-theme attribute on the document's root element (<html>).

Setting Theme Manually

// Set to dark theme
document.documentElement.setAttribute("data-theme", "dark");

// Set to light theme
document.documentElement.setAttribute("data-theme", "light");

Toggle Theme Manually

function toggleTheme() {
  const currentTheme = document.documentElement.getAttribute("data-theme");
  const newTheme = currentTheme === "dark" ? "light" : "dark";
  document.documentElement.setAttribute("data-theme", newTheme);
}

React Example (Manual)

import { useState, useEffect } from "react";
import { Button } from "bechbox-ui";

function App() {
  const [theme, setTheme] = useState<"light" | "dark">("light");

  useEffect(() => {
    document.documentElement.setAttribute("data-theme", theme);
    // Optionally save to localStorage
    localStorage.setItem("my-theme", theme);
  }, [theme]);

  const toggleTheme = () => {
    setTheme((prev) => (prev === "light" ? "dark" : "light"));
  };

  return (
    <div>
      <Button onClick={toggleTheme}>
        Switch to {theme === "light" ? "dark" : "light"} mode
      </Button>
      {/* Rest of your app */}
    </div>
  );
}

Theme Persistence

When using ThemeProvider, the theme preference is automatically saved to localStorage and restored on page load. If you're managing themes manually, you'll need to handle persistence yourself:

// On mount, restore theme from localStorage
useEffect(() => {
  const savedTheme = localStorage.getItem("my-theme") as "light" | "dark";
  if (savedTheme) {
    document.documentElement.setAttribute("data-theme", savedTheme);
  }
}, []);

// Save theme when it changes
useEffect(() => {
  const theme = document.documentElement.getAttribute("data-theme");
  if (theme) {
    localStorage.setItem("my-theme", theme);
  }
}, [theme]);

Available Themes

  • light - Light theme with white backgrounds and dark text
  • dark - Dark theme with dark backgrounds and light text

All components automatically adapt to the current theme using CSS custom properties. The theme system is CSS-based, so it works even without JavaScript enabled (though you'll need JS to switch themes).