npx gluestack-ui add accordionimport {
Accordion,
AccordionItem,
AccordionHeader,
AccordionTrigger,
AccordionTitleText,
AccordionContent,
AccordionContentText,
AccordionIcon,
} from '@/components/ui/accordion';
export default () => (
<Accordion>
<AccordionItem>
<AccordionHeader>
<AccordionTrigger>
<AccordionTitleText />
<AccordionIcon />
</AccordionTrigger>
</AccordionHeader>
<AccordionContent>
<AccordionContentText />
</AccordionContent>
</AccordionItem>
</Accordion>
);
| Prop | Type | Default | Description |
|---|---|---|---|
type | "single" | "multiple" | "single" | Determines whether one or multiple items can be opened at the same time. |
isCollapsible | boolean | true | When type is "single" or "multiple", allows closing content when clicking trigger for an open item. |
defaultValue | string[] | [] | The value of the item to expand when initially rendered when type is "single" or "multiple". |
value | string[] | [] | The controlled value of the item to expand when type is "single" or "multiple". |
onValueChange | function | - | Event handler called when the expanded state of an item changes and type is "single" or "multiple". |
isDisabled | boolean | false | When true, prevents the user from interacting with the accordion and all its items. |
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | - | The controlled value of the item to expand when type is "single" or "multiple". Must be used in conjunction with onValueChange. This is a mandatory prop. |
isDisabled | boolean | false | When true, prevents the user from interacting with the accordion and all its items. |