Accordion

GitHub
Create expandable content sections for better information organization.

Usage

Use the accordion and accordion-item components to display an Accordion in your content.

::accordion
---
defaultValue:
  - '1'
---

::accordion-item{label="Is Nuxt UI free to use?" icon="i-lucide-circle-help"}
Yes! Nuxt UI is completely free and open source under the MIT license. All 125+ components are available to everyone.
::

::accordion-item{label="Can I use Nuxt UI with Vue without Nuxt?" icon="i-lucide-circle-help"}
Yes! While optimized for Nuxt, Nuxt UI works perfectly with standalone Vue projects via our Vite plugin. You can follow the [installation guide](/docs/getting-started/installation/vue) to get started.
::

::accordion-item{label="Is Nuxt UI production-ready?" icon="i-lucide-circle-help"}
Yes! Nuxt UI is used in production by thousands of applications with extensive tests, regular updates, and active maintenance.
::

::

API

Props

Prop Default Type
type'multiple' "multiple" | "single"
ui { root?: ClassNameValue; trigger?: ClassNameValue; } & { root?: ClassNameValue; item?: ClassNameValue; header?: ClassNameValue; trigger?: ClassNameValue; content?: ClassNameValue; body?: ClassNameValue; leadingIcon?: ClassNameValue; trailingIcon?: ClassNameValue; label?: ClassNameValue; }

Slots

Slot Type
default{}

Theme

app.config.ts
export default defineAppConfig({
  ui: {
    prose: {
      accordion: {
        slots: {
          root: 'my-5',
          trigger: 'text-base'
        }
      },
      accordionItem: {
        base: 'pb-4 text-muted *:first:mt-0 *:last:mb-0 *:my-1.5'
      }
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'

export default defineConfig({
  plugins: [
    vue(),
    ui({
      ui: {
        prose: {
          accordion: {
            slots: {
              root: 'my-5',
              trigger: 'text-base'
            }
          },
          accordionItem: {
            base: 'pb-4 text-muted *:first:mt-0 *:last:mb-0 *:my-1.5'
          }
        }
      }
    })
  ]
})

Changelog

Soon
  • 7d1e8 — fix(components): improve slots return types and tests (#6109)
v4.5.0
v4.4.0
  • 55646 — feat(components): add valueKey prop (#5905)
v4.2.0
  • dd81d — feat(components): add data-slot attributes (#5447)
v4.1.0
  • 63c0a — feat(components): expose ui in slot props where used (#5207)
v3.3.4
  • 11a03 — fix(components): dot notation type support for labelKey and valueKey (#4933)
v3.3.3
  • 61b60 — feat(Icon): allow passing a component instead of a name (#4766)
v3.3.1
  • 5cb65 — feat: import @nuxt/ui-pro components (#4675)
v3.1.2
  • b9adc — feat(components): add ui field in items (#4060)
  • e6e51 — fix(components): class should have priority over ui prop
v3.1.0
  • 75e47 — fix(Accordion): use div instead of h3 for header tag
  • d49e0 — feat(module): define neutral utilities (#3629)
  • 8dd9d — fix(types): improve dynamic slots (#3857)
  • 39c86 — fix(components): refactor types after @nuxt/module-builder upgrade (#3855)
v3.0.2
  • b9983 — fix(components): improve generic types (#3331)
v3.0.1
  • ef861 — chore(components): add eol in script tag to fix syntax highlight