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';
Component name
The nameMuiAccordion
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. | |
classes | object | Override or extend the styles applied to the component. See CSS API below for more details. | |
defaultExpanded | bool | false | Если true , аккордеон по умолчанию развернут. |
disabled | bool | false | Если true , компонент отключен. |
disableGutters | bool | false | If true , it removes the margin between two expanded accordion items and the increase of height. |
expanded | bool | false | Если true , разворачивает аккордеон, в противном случае - сворачивает его. Установка этого свойства позволяет управлять аккордеоном. |
onChange | func | Коллбэк, вызываемый при изменении состояния "развернут/свернут". Сигнатура: function(event: object, expanded: boolean) => void event: Объект события. Предупреждение: Это универсальное событие, а не событие изменения. expanded: Состояние expanded . | |
square | bool | false | Если true , скругленные углы отключены. |
sx | object | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. | |
TransitionComponent | elementType | Collapse | Компонент, используемый в анимации сворачивания. Прочтите это руководство, чтобы узнать больше о требованиях к этому компоненту. |
TransitionProps | object | Свойства, передаваемые в анимируемый компонент. По умолчанию элемент основывается на компоненте 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 name | Global class | Описание |
---|---|---|
root | .MuiAccordion-root | Styles applied to the root element. |
rounded | .MuiAccordion-rounded | Styles applied to the root element unless square={true} . |
expanded | .Mui-expanded | Pseudo-class applied to the root element if expanded={true} . |
disabled | .Mui-disabled | Pseudo-class applied to the root element if disabled={true} . |
gutters | .MuiAccordion-gutters | Styles 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:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.