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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@rachelallyson/heroui-font-picker

v1.0.0

Published

A powerful font picker component for HeroUI with Google Fonts integration and sprite-based previews

Readme

@rachel-allyson/heroui-font-picker

A powerful font picker component for HeroUI with Google Fonts integration and sprite-based previews.

Features

  • 🎨 1,785+ Google Fonts with instant previews
  • 🖼️ Sprite-based Previews - Zero loading time for font previews
  • 🚀 Intelligent Loading - Only loads 4 essential variants by default
  • 🎯 HeroUI Integration - Seamless integration with HeroUI components
  • 📱 React Hook Form - Built-in support for form integration
  • TypeScript - Full TypeScript support
  • 🎨 Customizable - Flexible styling and behavior options

Installation

npm install @rachel-allyson/heroui-font-picker

Dual Package Strategy

The font picker uses a dual import strategy that provides flexibility for users to choose between individual HeroUI packages or the all-in-one @heroui/react package:

Default Path: Individual Packages

npm install @rachel-allyson/heroui-font-picker @heroui/autocomplete react react-dom
import { FontPicker } from '@rachel-allyson/heroui-font-picker';
// Uses individual @heroui/autocomplete package

Alternative Path: All-in-One Package

npm install @rachel-allyson/heroui-font-picker @heroui/react react react-dom
import { FontPicker } from '@rachel-allyson/heroui-font-picker/react';
// Uses @heroui/react package

Benefits

  • Bundle Size: Individual packages allow tree-shaking for smaller bundles
  • Flexibility: Choose the approach that fits your project
  • Compatibility: Works with both installation strategies
  • Future-Proof: Can adapt if HeroUI's packaging strategy changes

Quick Start

Basic Usage

import { FontPicker } from '@rachel-allyson/heroui-font-picker';

function MyComponent() {
  const [selectedFont, setSelectedFont] = useState('Inter');

  return (
    <FontPicker
      label="Choose Font"
      description="Select your preferred font"
      value={selectedFont}
      onSelectionChange={(key) => setSelectedFont(key as string)}
      placeholder="Choose a font..."
      showFontPreview={true}
      size="md"
      variant="bordered"
      isRequired
    />
  );
}

With Form Integration

import { FontPickerField } from '@rachel-allyson/heroui-font-picker';

function MyForm() {
  const [font, setFont] = useState('Inter');
  const [error, setError] = useState('');

  return (
    <FontPickerField
      label="Choose Font"
      description="Select your preferred font"
      value={font}
      onChange={setFont}
      error={error}
      fontPickerProps={{
        showFontPreview: true,
        loadAllVariants: false
      }}
    />
  );
}

Props

FontPicker Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | value | string | - | Current selected font | | onChange | (value: string) => void | - | Callback when font changes | | disabled | boolean | false | Whether the picker is disabled | | showFontPreview | boolean | true | Show font preview sprites | | loadAllVariants | boolean | false | Load all font variants vs 4 essential | | onFontsLoaded | (loaded: boolean) => void | - | Callback when fonts finish loading | | fontsLoadedTimeout | number | 3000 | Timeout for font loading detection | | placeholder | string | "Select a font..." | Placeholder text | | className | string | - | Additional CSS classes |

FontPickerField Props

All FontPicker props plus:

| Prop | Type | Description | |------|------|-------------| | label | string | Field label | | description | string | Field description | | value | string | Current field value | | onChange | (value: string) => void | Change handler | | error | string | Error message to display |

Advanced Usage

Custom Font Loading

import { loadGoogleFont, getFourVariants } from '@rachel-allyson/heroui-font-picker';

// Load specific font with all variants
loadGoogleFont('Inter', ['0,300', '0,400', '0,500', '0,600', '0,700']);

// Load font with intelligent 4-variant selection
const font = { variants: ['0,300', '0,400', '0,500', '0,600', '0,700', '1,300', '1,400'] };
const essentialVariants = getFourVariants(font.variants);
loadGoogleFont('Inter', essentialVariants);

Font Loading Detection

import { checkFontLoaded } from '@rachel-allyson/heroui-font-picker';

const isLoaded = await checkFontLoaded('Inter', 5000);
console.log('Font loaded:', isLoaded);

Sprite System

The font picker uses a sophisticated sprite system for instant font previews:

  • 1,785+ Google Fonts pre-rendered as sprites
  • Zero loading time for previews
  • 30MB sprite files for complete coverage
  • CSS positioning for efficient rendering

Asset Management

The package is completely self-contained and includes all necessary assets (sprite files and CSS). The font picker automatically loads its required assets.

Framework Support

The package works seamlessly across all React frameworks:

  • Next.js: Works out of the box (demo includes minimal Next.js config for asset serving)
  • Vite: Works out of the box
  • Create React App: Works out of the box
  • Any other React framework: Works out of the box

For Next.js Users

The demo includes a simple Next.js configuration that serves assets from the package. You can copy this configuration to your next.config.js:

/** @type {import('next').NextConfig} */
const nextConfig = {
    transpilePackages: ['@rachel-allyson/heroui-font-picker'],
    async rewrites() {
        return [
            {
                source: '/sprite.:path*',
                destination: '/node_modules/@rachel-allyson/heroui-font-picker/dist/sprite.:path*'
            }
        ];
    }
}

module.exports = nextConfig

Note: This is only needed for Next.js. Other frameworks work without any configuration!

Inspired by react-fontpicker

This package takes inspiration from react-fontpicker but with key improvements:

  • Zero configuration: No manual CSS imports required
  • HeroUI integration: Built specifically for HeroUI components
  • Self-contained: All assets bundled with the package
  • Modern approach: Uses absolute paths for better asset resolution

Browser Support

  • Chrome 60+
  • Firefox 55+
  • Safari 12+
  • Edge 79+

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.