Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add drag behaviour to accordion #3637

Closed
stijns96 opened this issue Mar 20, 2025 · 6 comments · Fixed by #3684
Closed

Add drag behaviour to accordion #3637

stijns96 opened this issue Mar 20, 2025 · 6 comments · Fixed by #3684
Labels
enhancement New feature or request v3 #1289

Comments

@stijns96
Copy link
Contributor

Description

I think it would be very cool and helpful if the accordion items could have some drag functionality. I want my users to be able to add links to their account in a accordion form. They should be able to reorder it as well. Not sure if the accordion is the right component to add it or that it could be something on it's own. You might have different thoughts. See #825

Additional context

No response

@stijns96 stijns96 added enhancement New feature or request triage v3 #1289 labels Mar 20, 2025
@stijns96
Copy link
Contributor Author

stijns96 commented Mar 20, 2025

Anyone wondering how to make it work easily with vueuse, use UseSortable.

<script setup>
import { useSortable } from "@vueuse/integrations/useSortable";

const accordion = useTemplateRef("accordion");

const items = ref([
  {
    label: "Icons",
    icon: "i-lucide-smile",
    content: "You have nothing to do, @nuxt/icon will handle it automatically.",
  },
  {
    label: "Colors",
    icon: "i-lucide-swatch-book",
    content:
      "Choose a primary and a neutral color from your Tailwind CSS theme.",
  },
  {
    label: "Components",
    icon: "i-lucide-box",
    content:
      "You can customize components by using the `class` / `ui` props or in your app.config.ts.",
  },
]);

useSortable(accordion, items, {
  animation: 150,
});
</script>

<template>
  <UPageCard variant="subtle" title="Links">
    <UFormField label="Socials">
      <UAccordion ref="accordion" :items="items" />
    </UFormField>
  </UPageCard>
</template>

@benjamincanac maybe nice to add some docs for this that this is even easily possible?

Copy link
Member

We can definitely add this in the examples yes: https://ui.nuxt.com/components/accordion#examples

@benjamincanac
Copy link
Member

@stijns96 Do you plan to open a PR for this?

@stijns96
Copy link
Contributor Author

@stijns96 Do you plan to open a PR for this?

Sure!

@stijns96 stijns96 reopened this Mar 24, 2025
@stijns96
Copy link
Contributor Author

@benjamincanac

How to correctly contribute now a days? Is that from the V3 branch?

@HugoRCD
Copy link
Member

HugoRCD commented Mar 24, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v3 #1289
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants