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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ruuri

v2.1.0

Published

<h3 align="center">Any draggable layout supported based muuri for react.</h3>

Downloads

2,241

Readme

Features

  • All features of muuri are supported.
  • ✅ Drag between different containers.(see Example)
  • ✅ Flexible API, easy to understand, It's React style.
  • ✅ TypeScript support.
  • ✅ ESM, CommonJS support.
  • ✅ Almost all React versions are supported, such as React 16.8, React 17, React 18 or newer.
  • ✅ New technology enthusiasts, we will keep it updated if needed.

Rencently News

ruuri v2 will be released soon, migration from v1 checkout here

Table of Content

Motivation

To be honest, there was already a library called muuri-react that did a React adaptation for muuri before this library came out, but it hadn't been updated for years and his examples and code didn't work with the latest React versions, and there were users in the community asking for help every year.

In fact we wanted to handle drag and drop only and not rely on a specific muuri or React version, so our product will not contain muuri or React code, the library will rely on the React and muuri versions referenced by the applicable project.

We hope that this library will turn the muuri API into something like React, a simple idea, implemented in a simple way, resulting in very low maintenance. If there are any subsequent breaking updates to muuri or the React features used, feel free to raise an issue or open a pull request.

Get Started

  1. Add ruuri and muuri as dependencies.
yarn add ruuri muuri
  1. Import ruuri Component.
import DraggableGrid from 'ruuri';

...
  <DraggableGrid
    // Put your data here
    // Every data item must have a STRING type unique key, such as the id field in data below.
    data={[
      {
        id: 'id-1',
        ...
      },
      {
        id: 'id-2',
        ...
      }
    ]}
    renderItem={itemData => (<div>{ // your custom content here }</div>)}
    // pass grid options
    // see more options docs at https://github.com/haltu/muuri#-grid-options
    dragEnabled
    dragSort
    layout={
      {
        fillGaps: true
      }
    }

    // pass event handlers
    // see more event docs at https://github.com/haltu/muuri#-grid-events
    onSend={data => {
      // write your code here
    }}
    onDragStart={(data, event) => {
      // write your code here
    }}
  />
...

Additional

  • Use handler

    Get current muuri grid instance or container dom element by ref.

import DraggableGrid, { DraggableGridHandle } from 'ruuri';
import { useRef } from 'react';

...
  const ref = useRef<DraggableGridHandle | null>(null)

  // get muuri grid instance
  // @see https://github.com/haltu/muuri#grid-methods
  // ref.current?.grid?.getElement()

  // get muuri container dom element
  // ref.current?.container

...
  <DraggableGrid ref={ref} data={[]} />

Examples

ruuri v2 examples

ruuri v1 examples

License

Copyright © 2022-2023 vingeray Licensed under the MIT license.