Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-image-turntable

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-image-turntable

Display a set of images as a draggable 360 degree turntable.

  • 3.1.1-2
  • next
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.4K
increased by2.18%
Maintainers
1
Weekly downloads
 
Created
Source

React Image Turntable

Display a set of images as a draggable 360 degree turntable.

React Image Turntable with rotating car

👉   Try the demo  👈


NPM package License MIT GitHub CI status

Features

  • Accessible
  • Responsive & fluid with intrinsic sizing
  • Supports keyboard navigation
  • Teeny Tiny (less than 1kb gzipped)
  • Zero dependencies
  • Type safe

Install

npm i react-image-turntable
# Or
yarn add react-image-turntable
# Or
pnpm i react-image-turntable

Usage

Props

PropsTypeRequiredDefault ValueDescription
imagesstring[]undefinedList of image src attributes.
initialImageIndexnumber0Index of image to show first.
movementSensitivitynumber20The amount a "drag" has to move before an image changes to next or previous.

Example

import React from 'react';
import { ReactImageTurntable } from 'react-image-turntable';

const images = [
  'https://via.placeholder.com/1200x800?text=1',
  'https://via.placeholder.com/1200x800?text=2',
  'https://via.placeholder.com/1200x800?text=3',
];

export const Turntable = () => <ReactImageTurntable images={images} />;

Also see the example code in the repo.

Custom Styling

The library uses the first image passed to intrinsically size the component, it also exports following classNames to apply custom styles when needed.

classNamePurpose
CLASS_NAME_IMGBase class for images.
CLASS_NAME_IMG_PRIMARYClass of first rendered image (sets the size of the main component).
CLASS_NAME_IMG_SECONDARYClass of subsequent images.

Contributing

See the contributing guide to get started.


Browser Support

The library is built for ES2021.

Notes

Keywords

FAQs

Package last updated on 16 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc