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

fotorama-react

v1.4.0

Published

A modern, pure React image gallery component inspired by Fotorama, built from the ground up with React best practices, TypeScript support, and zero jQuery dependency.

Downloads

67

Readme

Fotorama React

npm version CI Code Quality Quality Gate Status Security Rating TypeScript License: MIT

A modern, pure React image gallery component inspired by Fotorama, built from the ground up with React best practices, TypeScript support, and zero jQuery dependency.

🔗 Links

Features

  • Pure React - No jQuery dependency, built for modern React
  • Responsive - Works perfectly on desktop and mobile
  • Keyboard Navigation - Arrow keys, F for fullscreen, Esc to exit
  • Touch Support - Swipe gestures for mobile devices
  • Customizable - Easy styling with CSS classes
  • Accessible - ARIA labels, alt text, keyboard navigation
  • TypeScript - Full type safety with exported interfaces
  • SSR Compatible - Works with Next.js, Gatsby, and other SSR frameworks
  • Performance - Optimized rendering and memory management
  • Tree Shakable - Import only what you need

Installation

# npm
npm install fotorama-react

# yarn
yarn add fotorama-react

# pnpm
pnpm add fotorama-react

Quick Start

import React from 'react';
import Fotorama from 'fotorama-react';
import 'fotorama-react/dist/index.css'; // or 'fotorama-react/css' for convenience

const images = [
  'https://example.com/image1.jpg',
  'https://example.com/image2.jpg',
  'https://example.com/image3.jpg'
];

function App() {
  return (
    <Fotorama
      items={images}
      width="100%"
      height={400}
      nav="thumbs"
      allowfullscreen
      loop
      autoplay={3000}
    />
  );
}

export default App;

Documentation

Key Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | items ⭐ | Array<string \| FotoramaItem> | Required | Images to display | | width | number \| string | '100%' | Gallery width | | height | number \| string | 400 | Gallery height | | nav | 'dots' \| 'thumbs' \| false | 'dots' | Navigation style | | allowfullscreen | boolean \| 'native' | false | Enable fullscreen | | autoplay | boolean \| number | false | Auto-advance (ms) | | transition | 'slide' \| 'crossfade' | 'slide' | Animation type |

→ See all props in documentation

Image Formats

Simple URLs

const items = [
  'https://example.com/image1.jpg',
  'https://example.com/image2.jpg'
];

Rich Objects with Metadata

const items = [
  {
    img: 'https://example.com/full-image.jpg',
    thumb: 'https://example.com/thumbnail.jpg',
    alt: 'Beautiful landscape',
    caption: 'Shot with NIKON D850 • 24-70mm f/2.8',
    popup: 'https://example.com/high-res.jpg' // For fullscreen
  }
];

Imperative API

Control the gallery programmatically using refs:

import { useRef } from 'react';
import Fotorama, { FotoramaAPI } from 'fotorama-react';

function GalleryWithControls() {
  const galleryRef = useRef<FotoramaAPI>(null);

  const goToNext = () => galleryRef.current?.next();
  const goToPrev = () => galleryRef.current?.prev();
  const enterFullscreen = () => galleryRef.current?.fullscreen();

  return (
    <div>
      <Fotorama ref={galleryRef} items={images} />
      <button onClick={goToPrev}>← Previous</button>
      <button onClick={goToNext}>Next →</button>
      <button onClick={enterFullscreen}>🔍 Fullscreen</button>
    </div>
  );
}

Styling & Theming

/* Import the base styles */
@import 'fotorama-react/dist/index.css'; /* or 'fotorama-react/css' */

/* Customize the gallery */
.my-gallery {
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.my-gallery .react-fotorama__caption {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

Framework Integration

Next.js

import dynamic from 'next/dynamic';

const Fotorama = dynamic(() => import('fotorama-react'), {
  ssr: false, // Optional: disable SSR
  loading: () => <div>Loading gallery...</div>
});

Gatsby

// Works out of the box with Gatsby
import Fotorama from 'fotorama-react';

Vite

// Works seamlessly with Vite
import Fotorama from 'fotorama-react';

TypeScript Support

Full TypeScript support with comprehensive type definitions:

import Fotorama, { 
  FotoramaProps, 
  FotoramaAPI, 
  FotoramaItem 
} from 'fotorama-react';

// All props are typed
const props: FotoramaProps = {
  items: images,
  width: 800,
  height: 600,
  nav: 'thumbs'
};

// API methods are typed
const api: FotoramaAPI = galleryRef.current;

Compared to Alternatives

| Feature | React Fotorama | React Image Gallery | React Responsive Carousel | |---------|---------------|-------------------|-------------------------| | No jQuery | ✅ | ✅ | ✅ | | TypeScript | ✅ | ❌ | ❌ | | Touch/Swipe | ✅ | ✅ | ✅ | | Keyboard Nav | ✅ | ❌ | ❌ | | Fullscreen | ✅ | ✅ | ❌ | | Thumbnails | ✅ | ✅ | ❌ | | SSR Safe | ✅ | ❌ | ✅ | | Bundle Size | ~15KB | ~25KB | ~20KB |

Migration from jQuery Fotorama

Migrating is straightforward with similar API design:

// Before (jQuery)
$('.fotorama').fotorama({
  width: 700,
  nav: 'thumbs',
  allowfullscreen: true
});

// After (React)
<Fotorama
  width={700}
  nav="thumbs"
  allowfullscreen
  items={images}
/>

→ Complete migration guide

Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Reporting Issues

Found a bug or have a feature request? Please open an issue with:

  • React version
  • Browser and OS
  • Steps to reproduce
  • Expected vs actual behavior

License

MIT License - see LICENSE file for details.

This project is free and open source. You can use it for any purpose, including commercial projects.

Credits & Acknowledgments

Note: This is a complete React rewrite and does not include any original Fotorama code. Both projects use the permissive MIT License.


⭐ Star us on GitHub if you find this project useful!

Made with ❤️ for the React community