title | components |
---|---|
Componente React Panel de Expansión |
Accordion, AccordionActions, AccordionDetails, AccordionSummary |
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. It was formerly known as the "expansion panel".
{{"demo": "pages/components/accordion/SimpleAccordion.js", "bg": true}}
Extiende el comportamiento por defecto del panel para crear un acordeón con el componente Accordion
.
{{"demo": "pages/components/accordion/ControlledAccordions.js", "bg": true}}
Here is an example of customizing the component. You can learn more about this in the overrides documentation page.
{{"demo": "pages/components/accordion/CustomizedAccordions.js"}}
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.
{{"demo": "pages/components/accordion/ActionsInAccordionSummary.js", "bg": true}}
The content of Accordions is mounted by default even if the panel is not expanded. This default behavior has server-side rendering and SEO in mind. 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 }} />
As with any performance optimization this is not a silver bullet. Be sure to identify bottlenecks first and then try out these optimization strategies.
Múltiples columnas pueden ser usadas para estructurar el contenido, y un texto de ayuda puede ser agregado al panel para asistir al usuario.
{{"demo": "pages/components/accordion/DetailedAccordion.js", "bg": true}}
(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.