On this page

Accordion

Live examples of Accordion, with the exact Vue file that renders each one.

Every example is a complete Vue file. Copy it into an app that has the registry installed, or open it in StackBlitz.

Questions and answers

One section open at a time.

Every 15 minutes. You can also start a sync from the connection page.

AccordionFaq.vue
<script setup lang="ts">
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'

const questions = [
  { value: 'often', title: 'How often do orders sync?', body: 'Every 15 minutes. You can also start a sync from the connection page.' },
  { value: 'failed', title: 'What happens to an order that fails?', body: 'It stays in the queue and is tried again three times. After that it shows on the Errors page.' },
  { value: 'history', title: 'How long is sync history kept?', body: '90 days. Export it from the History page to keep it longer.' },
]
</script>

<template>
  <!-- type="single" collapsible: one answer open at a time, and the open one can be closed again. -->
  <Accordion type="single" collapsible default-value="often" class="max-w-120">
    <AccordionItem v-for="item in questions" :key="item.value" :value="item.value">
      <AccordionTrigger>{{ item.title }}</AccordionTrigger>
      <AccordionContent>{{ item.body }}</AccordionContent>
    </AccordionItem>
  </Accordion>
</template>

Groups of settings

Several sections can stay open.

Orders, products and stock levels sync in both directions.

Store timezone: UTC+07:00.

AccordionSettings.vue
<script setup lang="ts">
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'
</script>

<template>
  <!-- type="multiple": sections open on their own. Unavailable sections stay in the list, disabled. -->
  <Accordion type="multiple" :default-value="['store']" class="max-w-120">
    <AccordionItem value="store">
      <AccordionTrigger>Online store</AccordionTrigger>
      <AccordionContent>
        <p>Orders, products and stock levels sync in both directions.</p>
        <p>Store timezone: UTC+07:00.</p>
      </AccordionContent>
    </AccordionItem>
    <AccordionItem value="erp">
      <AccordionTrigger>ERP</AccordionTrigger>
      <AccordionContent>Invoices and tax classes come from the ERP.</AccordionContent>
    </AccordionItem>
    <AccordionItem value="crm" disabled>
      <AccordionTrigger>CRM (needs the Pro plan)</AccordionTrigger>
      <AccordionContent>Customers and deals.</AccordionContent>
    </AccordionItem>
  </Accordion>
</template>