Colapsar
Un área de contenido que se puede colapsar y expandir.
Cuándo Usar
- Se puede usar para agrupar o ocultar regiones complejas para mantener la página limpia.
- El acordeón es un tipo especial de colapso, que permite que solo un panel se expanda a la vez.
Colapsar
Se puede expandir más de un panel a la vez.
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> Acordeón
Modo acordeón, solo un panel se puede expandir a la vez.
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> Nodo Extra / Iconos
Puede usar las propiedades `icon` y `expandIcon` para personalizar íconos.
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> Encabezado de Panel Personalizado
Personalice los estilos de encabezado para cada panel usando el slot `title`.
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
| Propiedad | Descripción | Tipo | Por defecto |
|---|---|---|---|
| type | Establece el comportamiento para permitir "single" o "multiple" elementos expandidos a la vez. | "single" | "multiple" | "multiple" |
| class | Clases CSS adicionales para aplicar al contenedor del acordeón. | string | '' |
AccordionItem
| Propiedad | Descripción | Tipo | Por defecto |
|---|---|---|---|
| title | El título de texto del elemento de acordeón. | string | '' |
| isOpen | Si el elemento está abierto por defecto. | boolean | false |
| icon | Icono para mostrar a la izquierda del título. | IconName | '' |
| expandIcon | Icono para mostrar a la derecha para el activador de expansión. | IconName | "ChevronDown" |
| class | Clases CSS adicionales para el elemento. | string | '' |