diff --git a/docs/app/components/content/examples/table/TableDragAndDropExample.vue b/docs/app/components/content/examples/table/TableDragAndDropExample.vue new file mode 100644 index 00000000..d06c6bf2 --- /dev/null +++ b/docs/app/components/content/examples/table/TableDragAndDropExample.vue @@ -0,0 +1,82 @@ + + + diff --git a/docs/content/3.components/accordion.md b/docs/content/3.components/accordion.md index c5c9daa5..9fcf5d8a 100644 --- a/docs/content/3.components/accordion.md +++ b/docs/content/3.components/accordion.md @@ -247,6 +247,18 @@ You can also pass the `value` of one of the items if provided. When `type="multiple"`, ensure to pass an array to the `default-value` prop or the `v-model` directive. :: +### With drag and drop + +Use the [`useSortable`](https://vueuse.org/integrations/useSortable/) composable from [`@vueuse/integrations`](https://vueuse.org/integrations/README.html) to enable drag and drop functionality on the Accordion. This integration wraps [Sortable.js](https://sortablejs.github.io/Sortable/) to provide a seamless drag and drop experience. + +The `useSortable` composable accepts various options, see the [useSortable](https://vueuse.org/integrations/useSortable/#usage) documentation for more examples. + +::component-example +--- +name: 'accordion-drag-and-drop-example' +--- +:: + ### With body slot Use the `#body` slot to customize the body of each item. @@ -292,18 +304,6 @@ props: --- :: -### With drag and drop - -Use the [`useSortable`](https://vueuse.org/integrations/useSortable/) composable from [`@vueuse/integrations`](https://vueuse.org/integrations/README.html) to enable drag and drop functionality on the accordion. This integration wraps [Sortable.js](https://sortablejs.github.io/Sortable/) to provide a seamless drag and drop experience. - -The `useSortable` composable accepts various options, see the [Usage](https://vueuse.org/integrations/useSortable/#usage) for more examples. - -::component-example ---- -name: 'accordion-drag-and-drop-example' ---- -:: - ## API ### Props diff --git a/docs/content/3.components/table.md b/docs/content/3.components/table.md index 30620544..fcfb3129 100644 --- a/docs/content/3.components/table.md +++ b/docs/content/3.components/table.md @@ -444,6 +444,25 @@ class: '!p-0' --- :: +### With drag and drop + +Use the [`useSortable`](https://vueuse.org/integrations/useSortable/) composable from [`@vueuse/integrations`](https://vueuse.org/integrations/README.html) to enable drag and drop functionality on the Table. This integration wraps [Sortable.js](https://sortablejs.github.io/Sortable/) to provide a seamless drag and drop experience. + +The `useSortable` composable accepts various options, see the [useSortable](https://vueuse.org/integrations/useSortable/#usage) documentation for more examples. + +::note +Since the table ref doesn't expose the tbody element, add a unique class to it via the `:ui` prop to target it with `useSortable` (e.g. `:ui="{ tbody: 'my-table-tbody' }"`). +:: + +::component-example +--- +prettier: true +collapse: true +name: 'table-drag-and-drop-example' +class: '!p-0' +--- +:: + ### With slots You can use slots to customize the header and data cells of the table.