Accordion
Generated from public Vue/TypeScript exports by
pnpm docs:generate. Edit source comments and stories to update this reference. Types describe the declared API; browser/device constraints are covered in the guides. This catalog reflects source commitfc6bfb108634735f1657e533206c3f8702ad357d; match your installed package and typed manifest before using an export. Source review does not establish registry-release availability.
Accordion
import { Accordion } from '@gxp-dev/app-ui'
Props
| Name | Type | Required / default | Description |
|---|---|---|---|
collapsible | boolean | undefined | — | When type is "single", allows closing content when clicking trigger for an open item. When type is "multiple", this prop has no effect. |
disabled | boolean | undefined | — | When true, prevents the user from interacting with the accordion and all its items |
dir | Direction | undefined | — | The reading direction of the accordion when applicable. If omitted, assumes LTR (left-to-right) reading mode. |
orientation | DataOrientation | undefined | — | The orientation of the accordion. |
unmountOnHide | boolean | undefined | — | When true, the element will be unmounted on closed state. |
asChild | boolean | undefined | — | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. |
as | AsTag | Component | undefined | — | The element or component this component should render as. Can be overwritten by asChild. |
type | SingleOrMultipleType | undefined | — | Determines whether a "single" or "multiple" items can be selected at a time. This prop will overwrite the inferred type from modelValue and defaultValue. |
modelValue | string | string[] | undefined | — | The controlled value of the active item(s). Use this when you need to control the state of the items. Can be binded with v-model |
defaultValue | string | string[] | undefined | — | The default active value of the item(s). Use when you do not need to control the state of the item(s). |
Events
| Name | Type | Required / default | Description |
|---|---|---|---|
update:modelValue | [value: string | string[] | undefined] | — | — |
Slots
| Name | Type | Required / default | Description |
|---|---|---|---|
default | {} | — | — |
Examples
These are authored Storybook excerpts, not complete standalone modules. Relative imports refer to the story file; in an app import public components from @gxp-dev/app-ui. Default meta arguments are applied before each story.
Default
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '.'
{
render: () => ({
components: { Accordion, AccordionContent, AccordionItem, AccordionTrigger },
template: `
<Accordion type="single" class="w-full max-w-md" default-value="item-1" collapsible>
<AccordionItem value="item-1">
<AccordionTrigger>Is it accessible?</AccordionTrigger>
<AccordionContent>
Yes. It adheres to the WAI-ARIA design pattern.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Is it styled?</AccordionTrigger>
<AccordionContent>
Yes. It comes with default styles that match the other components' aesthetic.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger>Is it animated?</AccordionTrigger>
<AccordionContent>
Yes. It's animated by default, but you can disable it if you prefer.
</AccordionContent>
</AccordionItem>
</Accordion>
`,
}),
}
Multiple
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '.'
{
name: 'Multiple',
render: () => ({
components: { Accordion, AccordionContent, AccordionItem, AccordionTrigger },
template: `
<Accordion type="multiple" class="w-full max-w-md" :default-value="['item-1', 'item-2']">
<AccordionItem value="item-1">
<AccordionTrigger>First Section</AccordionTrigger>
<AccordionContent>
This is the first section content. Multiple sections can be open at once.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Second Section</AccordionTrigger>
<AccordionContent>
This is the second section content. Try opening all sections simultaneously.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger>Third Section</AccordionTrigger>
<AccordionContent>
This is the third section content.
</AccordionContent>
</AccordionItem>
</Accordion>
`,
}),
}
AccordionContent
import { AccordionContent } from '@gxp-dev/app-ui'
Props
| Name | Type | Required / default | Description |
|---|---|---|---|
forceMount | boolean | undefined | — | Used to force mounting when more control is needed. Useful when controlling animation with Vue animation libraries. |
asChild | boolean | undefined | — | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. |
as | AsTag | Component | undefined | — | The element or component this component should render as. Can be overwritten by asChild. |
Slots
| Name | Type | Required / default | Description |
|---|---|---|---|
default | {} | — | — |
Examples
These are authored Storybook examples. Relative imports refer to the story file; in an app import public components from @gxp-dev/app-ui. Default meta arguments are applied before each story.
Default
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '.'
{
render: () => ({
components: { Accordion, AccordionContent, AccordionItem, AccordionTrigger },
template: `
<Accordion type="single" class="w-full max-w-md" default-value="item-1" collapsible>
<AccordionItem value="item-1">
<AccordionTrigger>Is it accessible?</AccordionTrigger>
<AccordionContent>
Yes. It adheres to the WAI-ARIA design pattern.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Is it styled?</AccordionTrigger>
<AccordionContent>
Yes. It comes with default styles that match the other components' aesthetic.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger>Is it animated?</AccordionTrigger>
<AccordionContent>
Yes. It's animated by default, but you can disable it if you prefer.
</AccordionContent>
</AccordionItem>
</Accordion>
`,
}),
}
Multiple
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '.'
{
name: 'Multiple',
render: () => ({
components: { Accordion, AccordionContent, AccordionItem, AccordionTrigger },
template: `
<Accordion type="multiple" class="w-full max-w-md" :default-value="['item-1', 'item-2']">
<AccordionItem value="item-1">
<AccordionTrigger>First Section</AccordionTrigger>
<AccordionContent>
This is the first section content. Multiple sections can be open at once.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Second Section</AccordionTrigger>
<AccordionContent>
This is the second section content. Try opening all sections simultaneously.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger>Third Section</AccordionTrigger>
<AccordionContent>
This is the third section content.
</AccordionContent>
</AccordionItem>
</Accordion>
`,
}),
}
AccordionItem
import { AccordionItem } from '@gxp-dev/app-ui'
Props
| Name | Type | Required / default | Description |
|---|---|---|---|
disabled | boolean | undefined | — | Whether or not an accordion item is disabled from user interaction. When true, prevents the user from interacting with the item. |
value | string | Required | A string value for the accordion item. All items within an accordion should use a unique value. |
asChild | boolean | undefined | — | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. |
as | AsTag | Component | undefined | — | The element or component this component should render as. Can be overwritten by asChild. |
unmountOnHide | boolean | undefined | — | When true, the element will be unmounted on closed state. |
Slots
| Name | Type | Required / default | Description |
|---|---|---|---|
default | {} | — | — |
Examples
These are authored Storybook examples. Relative imports refer to the story file; in an app import public components from @gxp-dev/app-ui. Default meta arguments are applied before each story.
Default
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '.'
{
render: () => ({
components: { Accordion, AccordionContent, AccordionItem, AccordionTrigger },
template: `
<Accordion type="single" class="w-full max-w-md" default-value="item-1" collapsible>
<AccordionItem value="item-1">
<AccordionTrigger>Is it accessible?</AccordionTrigger>
<AccordionContent>
Yes. It adheres to the WAI-ARIA design pattern.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Is it styled?</AccordionTrigger>
<AccordionContent>
Yes. It comes with default styles that match the other components' aesthetic.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger>Is it animated?</AccordionTrigger>
<AccordionContent>
Yes. It's animated by default, but you can disable it if you prefer.
</AccordionContent>
</AccordionItem>
</Accordion>
`,
}),
}
Multiple
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '.'
{
name: 'Multiple',
render: () => ({
components: { Accordion, AccordionContent, AccordionItem, AccordionTrigger },
template: `
<Accordion type="multiple" class="w-full max-w-md" :default-value="['item-1', 'item-2']">
<AccordionItem value="item-1">
<AccordionTrigger>First Section</AccordionTrigger>
<AccordionContent>
This is the first section content. Multiple sections can be open at once.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Second Section</AccordionTrigger>
<AccordionContent>
This is the second section content. Try opening all sections simultaneously.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger>Third Section</AccordionTrigger>
<AccordionContent>
This is the third section content.
</AccordionContent>
</AccordionItem>
</Accordion>
`,
}),
}
AccordionTrigger
import { AccordionTrigger } from '@gxp-dev/app-ui'
Props
| Name | Type | Required / default | Description |
|---|---|---|---|
asChild | boolean | undefined | — | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. |
as | AsTag | Component | undefined | — | The element or component this component should render as. Can be overwritten by asChild. |
Slots
| Name | Type | Required / default | Description |
|---|---|---|---|
default | {} | — | — |
icon | {} | — | — |
Examples
These are authored Storybook examples. Relative imports refer to the story file; in an app import public components from @gxp-dev/app-ui. Default meta arguments are applied before each story.
Default
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '.'
{
render: () => ({
components: { Accordion, AccordionContent, AccordionItem, AccordionTrigger },
template: `
<Accordion type="single" class="w-full max-w-md" default-value="item-1" collapsible>
<AccordionItem value="item-1">
<AccordionTrigger>Is it accessible?</AccordionTrigger>
<AccordionContent>
Yes. It adheres to the WAI-ARIA design pattern.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Is it styled?</AccordionTrigger>
<AccordionContent>
Yes. It comes with default styles that match the other components' aesthetic.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger>Is it animated?</AccordionTrigger>
<AccordionContent>
Yes. It's animated by default, but you can disable it if you prefer.
</AccordionContent>
</AccordionItem>
</Accordion>
`,
}),
}
Multiple
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '.'
{
name: 'Multiple',
render: () => ({
components: { Accordion, AccordionContent, AccordionItem, AccordionTrigger },
template: `
<Accordion type="multiple" class="w-full max-w-md" :default-value="['item-1', 'item-2']">
<AccordionItem value="item-1">
<AccordionTrigger>First Section</AccordionTrigger>
<AccordionContent>
This is the first section content. Multiple sections can be open at once.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Second Section</AccordionTrigger>
<AccordionContent>
This is the second section content. Try opening all sections simultaneously.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger>Third Section</AccordionTrigger>
<AccordionContent>
This is the third section content.
</AccordionContent>
</AccordionItem>
</Accordion>
`,
}),
}