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

react-book-experience

v0.1.0

Published

A beautiful, mobile-first React book reading component with word-precise pagination, swipe navigation, and reading position persistence

Readme

React Book Reader 📖

A beautiful, mobile-first React component for displaying long-form text with a book-like reading experience.

Features

  • 📱 Mobile-first design - Optimized for touch devices with swipe navigation
  • 📐 Word-precise pagination - Text never cuts off mid-word or mid-line
  • 💾 Reading position persistence - Automatically saves and restores reading position
  • 🎨 Beautiful typography - Elegant serif fonts with proper line height and spacing
  • 🌙 Dark mode support - Automatically adapts to system preferences
  • ⌨️ Keyboard navigation - Arrow keys, space bar for desktop users
  • 📍 Click-to-navigate page numbers - Jump to any page instantly
  • 🔄 Responsive - Adapts to any screen size with proper centering on desktop
  • Smooth animations - Page turn animations with rubber-band effect at boundaries

Installation

npm install react-book-experience

Usage

import { BookReader } from 'react-book-experience';
import 'react-book-experience/styles.css';

function App() {
  const bookText = `Your long book text goes here...`;

  return (
    <BookReader
      id="my-book-1"
      text={bookText}
      title="The Great Adventure"
      author="Jane Doe"
    />
  );
}

Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | id | string | ✅ | Unique identifier for the book. Used for storing reading position in localStorage. | | text | string | ✅ | The full text content of the book. | | title | string | - | Book title. Displayed on the cover page and as a running header. | | author | string | - | Author name. Displayed on the cover page. | | contentRegion | Partial<ContentRegion> | - | Custom padding for the content area. |

ContentRegion

interface ContentRegion {
  top: number;    // Top padding as % of viewport height (default: 8)
  bottom: number; // Bottom padding as % of viewport height (default: 6)
  left: number;   // Left padding as % of page width (default: 5)
  right: number;  // Right padding as % of page width (default: 5)
}

Examples

Basic Usage

<BookReader
  id="book-1"
  text={myBookText}
/>

With Title and Author (Cover Page)

<BookReader
  id="book-1"
  text={myBookText}
  title="Pride and Prejudice"
  author="Jane Austen"
/>

Custom Content Region

<BookReader
  id="book-1"
  text={myBookText}
  title="My Book"
  contentRegion={{
    top: 10,
    bottom: 8,
    left: 8,
    right: 8,
  }}
/>

Multiple Books

Each book maintains its own reading position:

function Library() {
  return (
    <>
      <BookReader id="book-1" text={book1Text} title="First Book" />
      <BookReader id="book-2" text={book2Text} title="Second Book" />
    </>
  );
}

Navigation

| Action | Mobile | Desktop | |--------|--------|---------| | Next page | Swipe left / Tap right side | Arrow Right / Down / Space / Click button | | Previous page | Swipe right / Tap left side | Arrow Left / Up / Click button | | Go to page | Click page number | Click page number |

Styling

The component uses CSS custom properties for theming. You can override these in your CSS:

.book-reader {
  --page-bg: #fdf8f0;
  --text-color: #2d2926;
  --page-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
  --footer-text: #8a847d;
  --transition-speed: 200ms;
}

Dark Mode

Dark mode is automatic based on system preferences. Override with:

@media (prefers-color-scheme: dark) {
  .book-reader {
    --page-bg: #1a1816;
    --text-color: #d4cfc8;
  }
}

Recommended Global Styles

For the best mobile experience, add these styles to your app to prevent pull-to-refresh interference:

body {
  overscroll-behavior-y: contain;
}

TypeScript

Full TypeScript support with exported types:

import { BookReader, BookReaderProps, ContentRegion } from 'react-book-experience';

Browser Support

  • Modern browsers (Chrome, Firefox, Safari, Edge)
  • iOS Safari
  • Android Chrome

License

MIT © Umut Erturk