Перейти к контенту

Accordion API

API documentation for the React Accordion component. Learn about the available props, and the CSS API.

Import

import Accordion from '@material-ui/core/Accordion';
// или
import { Accordion } from '@material-ui/core';
You can learn about the difference by reading this guide on minimizing bundle size.

Component name

The name MuiAccordion can be used when providing default props or style overrides in the theme.

Props

Props of the Paper component are also available.

ИмяТипПо-умолчаниюОписание
children*node
The content of the component.
classesobject
Override or extend the styles applied to the component. See CSS API below for more details.
defaultExpandedboolfalse
Если true, аккордеон по умолчанию развернут.
disabledboolfalse
Если true, компонент отключен.
disableGuttersboolfalse
If true, it removes the margin between two expanded accordion items and the increase of height.
expandedboolfalse
Если true, разворачивает аккордеон, в противном случае - сворачивает его. Установка этого свойства позволяет управлять аккордеоном.
onChangefunc
Коллбэк, вызываемый при изменении состояния "развернут/свернут".

Сигнатура:
function(event: object, expanded: boolean) => void
event: Объект события. Предупреждение: Это универсальное событие, а не событие изменения.
expanded: Состояние expanded.
squareboolfalse
Если true, скругленные углы отключены.
sxobject
The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details.
TransitionComponentelementTypeCollapse
Компонент, используемый в анимации сворачивания. Прочтите это руководство, чтобы узнать больше о требованиях к этому компоненту.
TransitionPropsobject
Свойства, передаваемые в анимируемый компонент. По умолчанию элемент основывается на компоненте Transition.

The ref is forwarded to the root element.

Inheritance

While not explicitly documented above, the props of the Paper component are also available on Accordion. You can take advantage of this to target nested components.

CSS

Rule nameGlobal classОписание
root.MuiAccordion-rootStyles applied to the root element.
rounded.MuiAccordion-roundedStyles applied to the root element unless square={true}.
expanded.Mui-expandedPseudo-class applied to the root element if expanded={true}.
disabled.Mui-disabledPseudo-class applied to the root element if disabled={true}.
gutters.MuiAccordion-guttersStyles applied to the root element unless disableGutters={true}.
region.MuiAccordion-regionСтили, применяемые к элементу региона, контейнеру с детьми.

You can override the style of the component using one of these customization options:

Demos