- Implementation
- DndSort Props
- DndSort.Card Props
- DndSort.Zone Props
- DndSortChangeEvent
Looking for design and usage docs?The Design Spec and Usage Guidelines documentation for the component will be available soon. Reach out to our team in the #ask-designsystem channel if you have questions or need assistance!
Common Examples
Bucketing
DndSort is a great way to create a drag-and-drop interface for moving items between different buckets.Sorting a list
DndSort is also a great way to create a drag-and-drop interface for sorting a list of items.Bucket and sort
DndSort can also be used to create a drag-and-drop interface for moving items between different buckets and sorting them within those buckets.Note this example also demonstrates cards initially beginning outside of the buckets.Validation
DndSort provides ways to validate the drag-and-drop interaction. This is useful for preventing invalid interactions, such as moving an item to a bucket that does not accept it.Basic Validation
The simplest way to validate is to use thetype prop on the DndSort.Card component in conjunction with acceptedTypes prop on the DndSort.Zone component.Advanced Validation
A more advanced way to validate is to use thevalidator prop on the DndSort.Zone component. This prop takes a function which receives the item id. The function should return a boolean indicating whether the drop is valid. Here are some examples of how to use the validator prop:Customization
DndSort provides a number of ways to customize the drag-and-drop interaction. This includes customizing the appearance of the items and zones.Advanced zone rendering
TheadvancedRenderer prop of DndSort.Zone is an alternative to children, allowing you to customize the appearance of the drop zone based upon its internal state.This allows you to show different content when a drag is happening, when an item is over the drop zone, or if the dragged item is valid/invalid for the drop zone.Custom card preview rendering
ThepreviewRenderer prop of DndSort.Card offers a means to customize the appearance of the card when it is being dragged. This is useful for showing a different appearance for the card, such as a simpler version of a complex card.Interactive Children
By default, theDndSort.Card places a button around the entire card. This is optimal for accessibility. But if you want to place interactive elements inside your card, it harms accessibility. To resolve this issue, set dragOnlyWithHandle on the DndSort.Card if your card has interactive elements.Anti-Patterns
Nesting
DndSort does not support nesting. i.e. you may not use a zone as an item.This is an intentional design decision to guarantee these components meet our accessibility and usability standards.If you have a use case that requires nesting, please reach out to us. We would love to hear about your use case and help you find a solution.Best Practices
dragOnlyWithHandle
Do
Don’t




