explaingit

haltu/muuri

10,955JavaScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

A JavaScript library for building draggable, filterable, and sortable grid layouts on web pages, handles the positioning math, animations, and drag-and-drop so you don't have to.

Mindmap

mindmap
  root((Muuri))
    What it does
      Grid layout engine
      Drag and drop
      Filter and sort
    Features
      Web Worker layouts
      Cross-grid dragging
      Auto-scroll
      Nested grids
    Tech stack
      JavaScript
      CSS
    Audience
      Web developers
      App builders
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a draggable dashboard where users can rearrange tiles or cards with smooth animations that snap into place.

USE CASE 2

Create a filterable image gallery that re-sorts and hides items on button click without reloading the page.

USE CASE 3

Implement a kanban-style board where cards can be dragged between separate grid columns.

USE CASE 4

Build a masonry-style content layout where items can be sorted by any value you choose.

Tech stack

JavaScriptCSSWeb Workers

Getting it running

Difficulty · easy Time to first run · 30min

In plain English

Muuri is a JavaScript library that helps web developers build grid-based page layouts where items can be moved, sorted, filtered, and animated. Think of it as the engine behind a photo gallery or dashboard where you can drag tiles around, hide certain cards with a filter button, and have everything snap into place smoothly. The core idea is that CSS alone is sometimes not enough for layouts that need to respond to user actions. Muuri sits on top of your existing HTML and handles the math for positioning, the animations for showing or hiding items, and the drag-and-drop mechanics. It can run its layout calculations in a background thread (called a web worker) so the page stays responsive even when there are many items to arrange. Some of the things Muuri supports out of the box: dragging items between separate grids on the same page, auto-scrolling the page while a user drags near the edges, nesting one grid inside another, and filtering or sorting the visible items without reloading. The layout itself is fully configurable, so developers can create masonry-style columns, fixed-size tile grids, or more unusual arrangements. To use Muuri you install it via npm or include a script tag, add some basic HTML markup with a container and item elements, apply a small amount of CSS to position them correctly, then initialize it with one line of JavaScript pointing at your container. From there you call methods on the grid object to add items, trigger a filter, sort by a value, or enable drag-and-drop. Muuri is aimed at developers building interactive web pages or applications. It does not include a design system or visual styles, just the layout and interaction logic. The README is longer than what was shown.

Copy-paste prompts

Prompt 1
Using Muuri, help me create a grid of cards where clicking a filter button hides certain categories and the remaining cards animate smoothly into their new positions.
Prompt 2
I want to build a Trello-like board using Muuri where cards can be dragged between multiple columns. Show me the JavaScript initialization and drag configuration.
Prompt 3
Help me set up a Muuri grid that auto-scrolls the page when a user drags an item near the viewport edge.
Prompt 4
Show me the minimal HTML, CSS, and JavaScript needed to initialize a Muuri grid and make it draggable.
Prompt 5
I have a Muuri grid with 100 items and want to sort them by a data attribute when the user clicks a sort button. Walk me through the sort API.
Open on GitHub → Explain another repo

← haltu on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.