Accordion
A vertically stacked set of interactive headings that each reveal a section of content.
Preview
Zostel is India's largest chain of backpacker hostels, offering affordable stays in beautiful destinations across India and Nepal. We provide a community-driven travel experience with common areas, events, and curated local experiences.
Usage
tsx
import {
Accordion,
AccordionItem,
AccordionTrigger,
AccordionContent,
} from "zostel-ui";
<Accordion type="single" collapsible>
<AccordionItem value="item-1">
<AccordionTrigger>What is Zostel?</AccordionTrigger>
<AccordionContent>
Zostel is India's largest chain of backpacker hostels.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>How do I book?</AccordionTrigger>
<AccordionContent>
Book directly on our website or app.
</AccordionContent>
</AccordionItem>
</Accordion>Props
| Prop | Type | Default | Description |
|---|---|---|---|
type | "single" | "multiple" | "single" | Whether one or multiple items can be opened at the same time. |
collapsible | boolean | false | When type is "single", allows closing the open item. |
defaultValue | string | string[] | — | The value(s) of the item(s) to expand by default. |
value | string | string[] | — | The controlled value(s) of the expanded item(s). |
onValueChange | (value: string | string[]) => void | — | Callback fired when expanded items change. |
typeType:
"single" | "multiple"Default: "single"
Whether one or multiple items can be opened at the same time.
collapsibleType:
booleanDefault: false
When type is "single", allows closing the open item.
defaultValueType:
string | string[]Default: —
The value(s) of the item(s) to expand by default.
valueType:
string | string[]Default: —
The controlled value(s) of the expanded item(s).
onValueChangeType:
(value: string | string[]) => voidDefault: —
Callback fired when expanded items change.