# react-3d-tablet-carousel

> A lightweight 3D floating tablet carousel for React.

Latest version **1.0.3** (published 2026-09-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-3d-tablet-carousel
pnpm add react-3d-tablet-carousel
yarn add react-3d-tablet-carousel
bun add react-3d-tablet-carousel
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2026-09-24 |
| First published | 2026-09-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 84.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | abhishek_ghosh |
| Keywords | react, carousel, 3d, tablet, image-carousel, 3d-carousel |

## Links

- npm: https://www.npmjs.com/package/react-3d-tablet-carousel
- npm.io page: https://npm.io/package/react-3d-tablet-carousel

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2026-09-24
- 1.0.2 — 2026-09-24
- 1.0.1 — 2026-09-24
- 1.0.0 — 2026-09-23

## README

# react-3d-tablet-carousel

A lightweight 3D floating tablet/image carousel for React.

Designed for screenshots, product previews, portfolios, landing pages, and split-screen layouts where the active image stays large and readable while nearby images sit behind it in 3D.

## Installation

```bash
npm install react-3d-tablet-carousel
```

Import the component and its styles:

```jsx
import { TabletCarousel } from "react-3d-tablet-carousel";
import "react-3d-tablet-carousel/styles.css";
```

---

## Two common layouts

### 1. Full-screen / full-width carousel

Use this when the carousel should occupy the available page or viewport area.

```jsx
<TabletCarousel
  imagePath="/images"
  imageNames={["01.png", "02.png", "03.png", "04.png", "05.png"]}
  sizing="viewport"
  align="center"
/>
```

With Vite/React, the files can live in:

```text
public/
└── images/
    ├── 01.png
    ├── 02.png
    ├── 03.png
    ├── 04.png
    └── 05.png
```

The browser URL for `01.png` is:

```text
/images/01.png
```

### 2. 50% split-screen carousel

Use `sizing="container"` when the carousel is inside a parent such as a 50/50 layout.

```jsx
<div style={{ display: "flex", width: "100%" }}>
  <div style={{ width: "50%" }}>Your content</div>

  <div style={{ width: "50%" }}>
    <TabletCarousel
      imagePath="/images"
      imageNames={["01.png", "02.png", "03.png", "04.png", "05.png"]}
      sizing="container"
      width="100%"
      align="center"
    />
  </div>
</div>
```

`container` sizing makes the carousel respond to the width of its parent instead of the browser viewport.

---

## Using image URLs

You can also pass complete image URLs directly:

```jsx
<TabletCarousel
  images={[
    "https://example.com/images/01.png",
    "https://example.com/images/02.png",
    "https://example.com/images/03.png",
  ]}
/>
```

You can also use local paths:

```jsx
<TabletCarousel
  images={["/images/01.png", "/images/02.png", "/images/03.png"]}
/>
```

---

## Image loading

The carousel supports smart loading so the active image and nearby images are loaded first.

```jsx
<TabletCarousel
  images={[
    "/images/01.png",
    "/images/02.png",
    "/images/03.png",
    "/images/04.png",
  ]}
  imageLoading="smart"
  preloadDistance={1}
/>
```

Options:

- `smart` — preload the active image and nearby images
- `lazy` — use browser lazy loading
- `eager` — load images eagerly
- `auto` — let the browser decide

---

## Controls and interaction

The carousel supports:

- Mouse / touch swipe
- Dragging
- Previous / next buttons
- Pagination dots
- Clicking side images
- Keyboard arrow keys
- Mouse wheel / trackpad navigation
- Optional autoplay

Example:

```jsx
<TabletCarousel
  images={["/01.png", "/02.png", "/03.png", "/04.png"]}
  showArrows
  showDots
  swipeEnabled
  keyboardEnabled
  wheelEnabled
  clickSideImages
/>
```

---

## Autoplay

```jsx
<TabletCarousel
  images={["/01.png", "/02.png", "/03.png"]}
  autoPlay
  autoPlayInterval={4000}
/>
```

`autoPlayInterval` is in milliseconds.

---

## 3D customization

Adjust the depth and perspective of the carousel:

```jsx
<TabletCarousel
  images={["/01.png", "/02.png", "/03.png", "/04.png"]}
  perspective={1400}
  depth={260}
  rotation={32}
  sideScale={0.72}
  sideOpacity={0.82}
  maxVisible={2}
/>
```

Common options:

| Prop          | Default | Description                         |
| ------------- | ------: | ----------------------------------- |
| `perspective` |  `1400` | 3D perspective                      |
| `depth`       |   `260` | Distance of side images             |
| `rotation`    |    `32` | Side-image rotation                 |
| `sideScale`   |  `0.72` | Scale of side images                |
| `sideOpacity` |  `0.82` | Side-image opacity                  |
| `maxVisible`  |     `2` | Number of images shown on each side |

---

## Floating animation

The active tablet can gently float vertically:

```jsx
<TabletCarousel
  images={["/01.png", "/02.png", "/03.png"]}
  float
  floatAmplitude={10}
  floatDuration={4.8}
/>
```

Disable it with:

```jsx
<TabletCarousel images={["/01.png", "/02.png", "/03.png"]} float={false} />
```

---

## Animation

```jsx
<TabletCarousel
  images={["/01.png", "/02.png", "/03.png"]}
  transitionDuration={650}
  easing="cubic-bezier(.22,1,.36,1)"
/>
```

---

## Callbacks

Listen for the active image changing:

```jsx
<TabletCarousel
  images={["/01.png", "/02.png", "/03.png"]}
  onChange={(index) => {
    console.log("Active image:", index);
  }}
/>
```

Handle image clicks:

```jsx
<TabletCarousel
  images={["/01.png", "/02.png", "/03.png"]}
  onImageClick={(index, image) => {
    console.log("Clicked:", index, image);
  }}
/>
```

---

## Common props

| Prop               | Default      | Description                        |
| ------------------ | ------------ | ---------------------------------- |
| `images`           | `[]`         | Array of image URLs                |
| `imagePath`        | `""`         | Base path for local images         |
| `imageNames`       | —            | Image filenames                    |
| `startIndex`       | `0`          | Initial active image               |
| `loop`             | `true`       | Loop from last image to first      |
| `autoPlay`         | `false`      | Enable autoplay                    |
| `autoPlayInterval` | `4000`       | Autoplay interval in ms            |
| `swipeEnabled`     | `true`       | Enable swipe / drag                |
| `keyboardEnabled`  | `true`       | Enable keyboard navigation         |
| `wheelEnabled`     | `true`       | Enable wheel navigation            |
| `clickSideImages`  | `true`       | Allow clicking side images         |
| `showArrows`       | `true`       | Show navigation arrows             |
| `showDots`         | `true`       | Show pagination dots               |
| `showCounter`      | `false`      | Show image counter                 |
| `showHint`         | `false`      | Show interaction hint              |
| `sizing`           | `"viewport"` | `"viewport"` or `"container"`      |
| `align`            | `"center"`   | `"center"`, `"left"`, or `"right"` |
| `width`            | —            | Carousel/tablet width              |
| `aspectRatio`      | `"16 / 9"`   | Image aspect ratio                 |
| `float`            | `true`       | Enable floating animation          |
| `imageLoading`     | `"smart"`    | Image loading strategy             |
| `preloadDistance`  | `1`          | Number of nearby images to preload |

---

## License

MIT

---
_Source: https://npm.io/package/react-3d-tablet-carousel · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
