Zusammenklappen
Ein Inhaltsbereich, der ein- und ausgeblendet werden kann.
Wann verwenden
- Kann verwendet werden, um komplexe Regionen zu gruppieren oder auszublenden, um die Seite sauber zu halten.
- Akkordeon ist eine besondere Art des Zusammenklappens, bei der nur ein Panel gleichzeitig erweitert werden kann.
Zusammenklappen
Es kann mehr als ein Panel gleichzeitig erweitert werden.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
astro
<Accordion>
<AccordionItem title="This is panel header 1">
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
</AccordionItem>
<AccordionItem title="This is panel header 2">
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
</AccordionItem>
<AccordionItem title="This is panel header 3">
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
</AccordionItem>
</Accordion> Akkordeon
Akkordeon-Modus, nur ein Panel kann gleichzeitig erweitert werden.
This is panel header 1 content
This is panel header 2 content
This is panel header 3 content
astro
<Accordion type="single">
<AccordionItem title="This is panel header 1" isOpen>
This is panel header 1 content
</AccordionItem>
<AccordionItem title="This is panel header 2">
This is panel header 2 content
</AccordionItem>
<AccordionItem title="This is panel header 3">
This is panel header 3 content
</AccordionItem>
</Accordion> Zusätzlicher Knoten / Symbole
Sie können die Eigenschaften `icon` und `expandIcon` verwenden, um Symbole anzupassen.
Manage your account settings and preferences.
View and update your payment methods and billing history.
Configure how you receive alerts and updates.
astro
<Accordion>
<AccordionItem title="Account Settings" icon="User">
Manage your account settings and preferences.
</AccordionItem>
<AccordionItem title="Billing Information" icon="CreditCard">
View and update your payment methods and billing history.
</AccordionItem>
<AccordionItem title="Notifications" icon="Bell">
Configure how you receive alerts and updates.
</AccordionItem>
</Accordion> Benutzerdefinierter Panel-Header
Passen Sie die Header-Stile für jedes Panel mit dem `title`-Slot an.
This item uses a custom slot for the title to allow complex layouts.
astro
<Accordion>
<AccordionItem>
<div slot="title" class="flex items-center justify-between w-full pr-4 text-left">
<span class="font-semibold text-blue-600 dark:text-blue-400">Custom Styled Title</span>
<span class="text-xs px-2 py-1 bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300 rounded-full">New</span>
</div>
This item uses a custom slot for the title to allow complex layouts.
</AccordionItem>
</Accordion> API
Accordion
| Eigenschaft | Beschreibung | Typ | Standard |
|---|---|---|---|
| type | Legt das Verhalten fest, um entweder "single" oder "multiple" gleichzeitig erweiterte Elemente zuzulassen. | "single" | "multiple" | "multiple" |
| class | Zusätzliche CSS-Klassen zur Anwendung auf den Akkordeon-Container. | string | '' |
AccordionItem
| Eigenschaft | Beschreibung | Typ | Standard |
|---|---|---|---|
| title | Der Texttitel des Akkordeon-Elements. | string | '' |
| isOpen | Ob das Element standardmäßig geöffnet ist. | boolean | false |
| icon | Symbol, das links vom Titel angezeigt wird. | IconName | '' |
| expandIcon | Symbol, das rechts für den Erweiterungstrigger angezeigt wird. | IconName | "ChevronDown" |
| class | Zusätzliche CSS-Klassen für das Element. | string | '' |