Header
Main Content
Sidebar
Article
Footer
Oihana Next UI - 0.9.0
<SortableGrid cols={ { xs : 2 , md : 3 , xl : 4 } } gap={ 4 } defaultItems={ photos } renderItem={ photo => ( <SortableGridItem><img draggable={ false } ... /></SortableGridItem> )}/><SortableGrid cols={ 3 } gap={ 4 } items={ cards } onReorder={ next => setCards( next ) } renderItem={ card => <SortableGridItem ... /> }/><SortableGrid handle defaultItems={ photos } renderItem={ photo => <SortableGridItem>...</SortableGridItem> }/>// handle : items drag only from the overlay button (top-right corner)<SortableGrid defaultItems={ photos } onReorder={ ( items ) => api.saveOrder( items ) } renderItem={ photo => <SortableGridItem>...</SortableGridItem> }/>// onReorder may return a promise : a rejection restores the previous order| Prop | Type | Description |
|---|---|---|
items / defaultItems | Array | Controlled / uncontrolled items (each needs a stable id) |
onReorder | function | (items, { from, to, item }) => void | Promise — a rejected promise reverts the order (uncontrolled) |
renderItem | function | (item, index) => SortableGridItem element |
handle | boolean | Show an overlay drag handle (default false : whole items draggable) |
getItemId | function | Custom accessor for item identity (defaults to item.id) |
disabled | boolean | Disable dragging for all items |
cols / gap / ... | Grid props | Every other prop is forwarded to Grid (responsive cols, gaps, alignment, ...) |