PU-Accordion Component
A customizable accordion component with smooth transitions and slot support
Usage
Basic Usage
First
Second
Custom
Items
Custom
Items
Prop | Type | Required | Default | Description |
---|---|---|---|---|
items | Array<{title: string, content: string}> | Yes | - | Accordion items data structure |
Slot | Props | Description |
---|---|---|
header | { item: object, isOpen: boolean } | Custom header template |
content | { item: object } | Custom content template |
- Base styling with Tailwind:
.accordion { @apply p-1 bg-white shadow-sm; @apply border-2 border-primary-light-500 rounded-lg; } .accordion-header { @apply flex justify-between items-center cursor-pointer p-2 font-bold; }
- Smooth transitions:
.accordion-enter-active, .accordion-leave-active { @apply transition-all duration-300; } .accordion-enter-from, .accordion-leave-to { @apply max-h-0 opacity-0; }