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

divz

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

divz

A React UI component that lets you scroll, swipe & zoom through HTML elements on the 3D z-axis

  • 1.1.11
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Divz

Latest npm version MIT License Monthly npm downloads

A React UI component that lets you scroll, swipe & zoom through HTML elements on the 3D z-axis

https://lewhunt.github.io/divz/

Click above to try out the demos


Installation

npm install divz

Basic Usage

Import the component and render it in your app or page, wrapping it around your list of divs or other HTML elements:

import { Divz } from "divz";

function App() {
  return (
    <Divz>
      <div>1</div>
      <div>2</div>
      <div>3</div>
      <div>4</div>
    </Divz>
  );
}

:point_right: Try out the demos :point_left:

https://lewhunt.github.io/divz


Advanced Usage

The demos illustrate how the component can be initialised with more props - along with images and videos inside the child divs - for a richer user experience. Demo 3 goes even further and uses a custom video component with preview images, optimised to only play video when the current item is active:

<Divz
  autoPlay={true}
  autoPlayDuration={7000}
  isDarkMode={true}
  onIndexChange={(i) => setSelectedIndex(i)}
>
  {demo3Assets.map((item, index) => (
    <DivzVideoItem
      key={index}
      index={index}
      selectedIndex={selectedIndex}
      previewImage={item.image}
      videoSource={item.video}
    ></DivzVideoItem>
  ))}
</Divz>

Here's a quick video of Demo 2, utilising dark mode, images and basic video elements:

https://github.com/lewhunt/divz/assets/9886284/25c5f39b-5ab7-4088-8fa8-e23f4bb80498


Why Divz?

Divz was created to quickly showcase portfolio work within a pseudo-3D environment, loosely inspired by Apple's Time Machine interface which allows the user to zoom through historical Finder windows:

https://en.wikipedia.org/wiki/Time_Machine_%28macOS%29

Apple's Time Machine was the inspiration for Divz


What Sets It Apart?

  • Simplified Integration: Divz is designed to be responsive and easy to use, acting as a straightforward wrapper around a list of divs or other HTML elements.
  • Diverse Applications: While the demos showcase its versatility as a carousel, slideshow, or gallery component, Divz opens the door to a range of other potential uses. Consider it an innovative, experimental method for navigating web content.
  • Broad Device Support: Divz accommodates various navigation modes, including touch for mobile devices, cursor/trackpad for desktop users, and arrow keys for TV devices.

How Does It Work?

Under the hood, Divz performs CSS3 transforms on the core component and the child HTML elements, set dynamically with React TypeScript. The component is packaged using Vite to allow npm library integration.


Props

PropDescriptionDefault
autoPlaySet to true to autoplay a carousel sequence of any children div elementsfalse
isAutoPlayLoopedSet to true to enable the autoPlay sequence to endlessly looptrue
autoPlayDurationSet the time interval in milliseconds for the autoPlay feature6000
showPlayButtonSet to true to display the autoPlay toggle buttontrue
showNavButtonsSet to true to display the up/down navigational buttons for cycling between div childrentrue
showExpandButtonSet to true to display the 'full-screen' expand button which is used to toggle the scale of div itemstrue
showNavButtonsOnExpandedSet to true to display the navigational buttons when div items have been expandedfalse
isExpandedSet to true to toggle the scale of div itemsfalse
isDarkModeSet to true to set the buttons UI styling to dark modefalse
isSnapEnabledSet to true to ensure the transform animation is snap-fixed to only move between the div itemstrue
isScrollPageEnabledSet to true to override the preferred 'fullscreen' behaviour and enable page scrolling with scrollbar. However, page scrolling is not recommended as it may also trigger the Divz swipe interactionsfalse
selectIndexSet the index number to force it to instantly jump to position of a div child item. By default it will instead zoom animate to the first item.null
classNameInsert additional classname values for overriding the component CSS stylingnull
onIndexChangeCalled when navigation occurs and the currently selected divz item has changed index
onPlayingCalled when autoPlay sequence starts or stops

Credits

Sample media used in the demos are from various open source projects:


Support

I hope this has given a good intro to the component and you get some use out of it for your own projects!

💬 Fire over a comment if you have any feedback, requests or issues 🐛

⭐ Give it a star if you like the component or want to bookmark it 🙏

Keywords

FAQs

Package last updated on 19 Jun 2024

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