Accordion (panel de expansión)
Los paneles de expansión contienen flujos de creación y permiten una edición simple de un elemento.
Un panel de expansión es un contenedor liviano que puede ser ya sea único o estar conectado a una superficie más grande, como una tarjeta.
Note: Expansion panels are no longer documented in the Material Design guidelines, but Material-UI will continue to support them. Antes era conocido como "panel de expansión".
Panel de expansión simple
Accordion 1
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
Accordion 2
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
Disabled Accordion
Acordeón controlado
Extiende el comportamiento por defecto del panel para crear un acordeón con el componente Accordion
.
General settings
I am an accordion
Nulla facilisi. Phasellus sollicitudin nulla et quam mattis feugiat. Aliquam eget maximus est, id dignissim quam.
Users
You are currently not an owner
Donec placerat, lectus sed mattis semper, neque lectus feugiat lectus, varius pulvinar diam eros in elit. Pellentesque convallis laoreet laoreet.
Advanced settings
Filtering has been entirely disabled for whole web server
Nunc vitae orci ultricies, auctor nunc in, volutpat nisl. Integer sit amet egestas eros, vitae egestas augue. Duis vel est augue.
Personal data
Nunc vitae orci ultricies, auctor nunc in, volutpat nisl. Integer sit amet egestas eros, vitae egestas augue. Duis vel est augue.
Panel de expansión personalizados
He aquí un ejemplo de personalización del componente. You can learn more about this in the overrides documentation page.
Collapsible Group Item #2
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
Collapsible Group Item #3
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
Acciones Adicionales
In order to put an action such as a Checkbox
or a button inside of the AccordionSummary
, you need to stop the propagation of the focus and click events to prevent the panel from expanding/collapsing when using the action. You should also provide an aria-label
for the action, otherwise the label of the nested action will be included in the label of the parent button that controls the accordion expansion.
The click event of the nested action will propagate up and expand the accordion unless you explicitly stop it.
The focus event of the nested action will propagate up and also focus the accordion unless you explicitly stop it.
If you forget to put an aria-label on the nested action, the label of the action will also be included in the label of the parent button that controls the accordion expansion.
Rendimiento
The content of Accordions is mounted by default even if the panel is not expanded. Este comportamiento por defecto tiene el renderizado del lado del servidor y SEO en mente. If you render expensive component trees inside your panels or simply render many panels it might be a good idea to change this default behavior by enabling the unmountOnExit
in TransitionProps
:
<Accordion TransitionProps={{ unmountOnExit: true }} />
Como en cualquier optimización de rendimiento esto no es una bala de plata. Be sure to identify bottlenecks first and then try out these optimization strategies.
Cabecera secundaria y columnas
Múltiples columnas pueden ser usadas para estructurar el contenido, y un texto de ayuda puede ser agregado al panel para asistir al usuario.
Accesibilidad
(WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#accordion)
Para óptima accesibilidad recomendamos establecer id
y aria-controls
en AccordionSummary
. El Accordion
derivará los necesarios aria-labelledby
y id
para la región de contenido del panel.