Skip to content

Make SortableGallery image removable via dnd-kit Sortable #196

Answered by igordanchenko
keymartech asked this question in Q&A
Discussion options

You must be logged in to vote

Neither removable attribute nor <Sortable /> component are part of the dnd-kit library. It's just an example they provide in the story book, very much like SortableGallery is just an example you can use a starting point in your implementation. For example, you can implement something to this effect:

<SortableGallery
  gallery={RowsPhotoAlbum}
  spacing={16}
  padding={10}
  photos={photos}
  movePhoto={(oldIndex, newIndex) => setPhotos(arrayMove(photos, oldIndex, newIndex))}
  render={{
    extras: (_, { index }) => (
      <button
        type="button"
        style={{
          position: "absolute",
          right: 0,
          top: 0,
          border: 0,
          background: "none",

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@keymartech
Comment options

Answer selected by igordanchenko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants