material-components / material-web

Material Design Web Components
https://material-web.dev
Apache License 2.0
9.42k stars 901 forks source link

Add reordering functionality to lists #959

Open ForestKatsch opened 4 years ago

ForestKatsch commented 4 years ago

Is your feature request related to a problem? Please describe. Lists are often reorderable, and list ordering via drag-and-drop is a rather complex and often-used feature that would fit better in this library instead of being reimplemented each time.

Describe the solution you'd like An event, onreordered/reordered, that's sent to the list (or maybe the list item) for each movement. The event would contain information about which mwc-list-item moved, and the index it came from and moved to. Ideally, a parameter on mwc-list-item (reordering?) would be set, so custom mwc-list-item replacement components would be able to change their style and/or layout when being reordered.

Describe alternatives you've considered Building custom list and list-item components to implement this behavior.

Additional context

https://material.io/components/lists/#behavior

525 is potentially related?

e111077 commented 4 years ago

Interesting feature: still currently rethinking the implementation of list so I will keep this in mind