Answer a question

Is it possible to drag/drop and change the sorting of the Material UI Cards? If so, how? https://material-ui.com/components/cards/

Answers

Is it possible to drag/drop and change the sorting of the Material UI Cards/

Yes.

how?

You can use react-dnd or react-beautiful-dnd.

They have alot of examples on how to do it and you can check it here for react-dnd.

Here is a working example of how to do it and, which is based on react-dnd examples.

And this is what react-beautiful-dnd has to say about both options:

There are a lot of libraries out there that allow for drag and drop interactions within React. Most notable of these is the amazing react-dnd. It does an incredible job at providing a great set of drag and drop primitives which work especially well with the wildly inconsistent html5 drag and drop feature. react-beautiful-dnd is a higher level abstraction specifically built for lists (vertical, horizontal, movement between lists, nested lists and so on). Within that subset of functionality react-beautiful-dnd offers a powerful, natural and beautiful drag and drop experience. However, it does not provide the breadth of functionality offered by react-dnd. So react-beautiful-dnd might not be for you depending on what your use case is.

Logo

React社区为您提供最前沿的新闻资讯和知识内容

更多推荐