Skip to main content

Accordion

Example

import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@databricks/appkit-ui/react"

export default function AccordionExample() {
return (
<Accordion type="single" collapsible className="w-full">
<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 matches the other
components&apos; aesthetic.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger>Is it animated?</AccordionTrigger>
<AccordionContent>
Yes. It&apos;s animated by default, but you can disable it if you
prefer.
</AccordionContent>
</AccordionItem>
</Accordion>
)
}

Accordion

Source: packages/appkit-ui/src/react/ui/accordion.tsx

Props

PropTypeRequiredDefaultDescription
typeenum--
valuestring | string[]-The controlled stateful value of the accordion item whose content is expanded. The controlled stateful value of the accordion items whose contents are expanded.
defaultValuestring | string[]-The value of the item whose content is expanded when the accordion is initially rendered. Use defaultValue if you do not need to control the state of an accordion. The value of the items whose contents are expanded when the accordion is initially rendered. Use defaultValue if you do not need to control the state of an accordion.
onValueChange((value: string) => void) | ((value: string[]) => void)-The callback that fires when the state of the accordion changes.
collapsiblebooleanfalseWhether an accordion item can be collapsed after it has been opened.
disabledboolean-Whether or not an accordion is disabled from user interaction. @defaultValue false
orientationenumverticalThe layout in which the Accordion operates.
direnum-The language read direction.
asChildboolean--

Usage

import { Accordion } from '@databricks/appkit-ui';

<Accordion /* props */ />

AccordionContent

Source: packages/appkit-ui/src/react/ui/accordion.tsx

Props

PropTypeRequiredDefaultDescription
asChildboolean--
forceMounttrue-Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.

Usage

import { AccordionContent } from '@databricks/appkit-ui';

<AccordionContent /* props */ />

AccordionItem

Source: packages/appkit-ui/src/react/ui/accordion.tsx

Props

PropTypeRequiredDefaultDescription
disabledboolean-Whether or not an accordion is disabled from user interaction. @defaultValue false
valuestring | string[]-The controlled stateful value of the accordion item whose content is expanded. The controlled stateful value of the accordion items whose contents are expanded.
asChildboolean--

Usage

import { AccordionItem } from '@databricks/appkit-ui';

<AccordionItem /* props */ />

AccordionTrigger

Source: packages/appkit-ui/src/react/ui/accordion.tsx

Props

PropTypeRequiredDefaultDescription
asChildboolean--

Usage

import { AccordionTrigger } from '@databricks/appkit-ui';

<AccordionTrigger /* props */ />