--- github: true description: Display togglable accordion panels. headlessui: label: 'Disclosure' to: 'https://headlessui.com/vue/disclosure' navigation: badge: 'Edge' --- ## Usage Pass an array to the `items` prop of the Accordion component. Each item can have any property from the [Button](/elements/button) component such as `label`, `icon`, `color`, `variant`, `size`, etc. but also: - `slot` - A key to customize the item with a slot. - `content` - The content to display in the panel by default. - `disabled` - Determines whether the item is disabled or not. - `defaultOpen` - Determines whether the item is initially open or closed. ::component-example #default :accordion-example-basic #code ```vue ``` :: ### Style You can also pass any prop from the [Button](/elements/button) component directly to the Accordion component to style the buttons. ::component-card --- baseProps: items: - label: "1. What is NuxtLabs UI?" content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" - label: "2. Getting Started" content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" - label: "3. Theming" content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" - label: "4. Components" content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" props: color: 'primary' variant: 'soft' size: 'sm' ui: variant: solid: 1 outline: 1 ghost: 1 soft: 1 link: 1 size: 2xs: '' xs: '' sm: '' md: '' lg: '' xl: '' --- :: ### Icon Use any icon from [Iconify](https://icones.js.org) by setting the `open-icon` and `close-icon` props by using this pattern: `i-{collection_name}-{icon_name}` or change it globally in `ui.accordion.default.openIcon` and `ui.accordion.default.closeIcon`. You can also set them to `null` to hide the icons. ::component-card --- baseProps: items: - label: "1. What is NuxtLabs UI?" content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" - label: "2. Getting Started" content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" - label: "3. Theming" content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" - label: "4. Components" content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" props: openIcon: 'i-heroicons-plus' closeIcon: 'i-heroicons-minus' excludedProps: - openIcon - closeIcon --- :: ### Open Use the `default-open` prop to open all items by default. ::component-card --- baseProps: items: - label: "What is NuxtLabs UI?" content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" - label: "Getting Started" content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" - label: "Theming" content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" - label: "Components" content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" props: defaultOpen: true excludedProps: - defaultOpen --- :: ## Slots You can use slots to customize the buttons and items content of the Accordion. ### `default` Use the `#default` slot to customize the trigger buttons. You will have access to the `item`, `index`, `open` properties and `close` method in the slot scope. ::component-example #default :accordion-example-default-slot #code ```vue ``` :: ### `item` Use the `#item` slot to customize the items content or pass a `slot` property to customize a specific item. You will have access to the `item`, `index`, `open` properties and `close` method in the slot scope. ::component-example #default :accordion-example-item-slot #code ```vue ``` :: ## Props :component-props ## Preset :component-preset