mui / mui/material-ui

[Masonry] Add a callback input that receives order of item

Open
#35,576 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

package: lab scope: masonry type: new feature
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates
  • I have searched the existing issues
Latest version
  • I have tested the latest version
Summary 💡

Masonry creates items with different order than the index of a loop. Currently, it doesn't seem possible to know the current order of an item without having to hack through it with refs and get the value of order style.

The order is needed for example when I want to display a larger box (a zoomed in image for example) when user hovers over an image items inside Masonry. Depending on current breakpoint and order of item, I need to know if the items is at first column, last column, or somewhere in between in order to correctly position the larger image without causing on overflow.

A callback that receives an id and order and fires after order is assigned to an item would be very helpful.

Examples 🌈

No response

Motivation 🔦

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Masonry component implementation and the point where item order is assigned. Trace how the component calculates order across breakpoints, then identify the existing component tests or examples to extend so the callback receives the requested item id and order after assignment.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.