Make SortableGallery image removable via dnd-kit Sortable #196
-
I see the ability to add |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Neither <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",
cursor: "pointer",
padding: 8,
}}
onKeyDown={(event) => {
event.stopPropagation();
}}
onClick={() => {
setPhotos(photos.filter((_, i) => index !== i));
}}
>
X
</button>
),
}}
/> |
Beta Was this translation helpful? Give feedback.
Neither
removable
attribute nor<Sortable />
component are part of thednd-kit
library. It's just an example they provide in the story book, very much likeSortableGallery
is just an example you can use a starting point in your implementation. For example, you can implement something to this effect: