Collapse API
Documentação da API para o componente React Collapse . Aprenda sobre as propriedades disponíveis e a API CSS.
Importação
import Collapse from '@mui/material/Collapse';
// ou
import { Collapse } from '@mui/material';The Collapse transition is used by the Vertical Stepper StepContent component. It uses react-transition-group internally.
Nome do componente
The nameMuiCollapse can be used when providing default props or style overrides in the theme.Propriedades
Propriedades do componente Transition também estão disponíveis.
| Nome | Tipo | Padrão | Descrição |
|---|---|---|---|
| addEndListener | func | Add a custom transition end trigger. Called with the transitioning DOM node and a done callback. Allows for more fine grained transition end logic. Note: Timeouts are still used as a fallback if provided. | |
| children | node | The content node to be collapsed. | |
| classes | object | Sobrescreve ou extende os estilos aplicados para o componente. Veja a API CSS abaixo para maiores detalhes. | |
| collapsedSize | number | string | '0px' | The width (horizontal) or height (vertical) of the container when collapsed. |
| component | element type | The component used for the root node. Either a string to use a HTML element or a component. ⚠️ Needs to be able to hold a ref. | |
| easing | { enter?: string, exit?: string } | string | The transition timing function. You may specify a single easing or a object containing enter and exit values. | |
| in | bool | false | If true, the component will transition in. |
| orientation | 'horizontal' | 'vertical' | 'vertical' | The collapse transition orientation. |
| sx | Array<func | object | bool> | func | object | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. | |
| timeout | 'auto' | number | { appear?: number, enter?: number, exit?: number } | duration.standard | The duration for the transition, in milliseconds. You may specify a single timeout for all transitions, or individually with an object. Set to 'auto' to automatically calculate transition time based on height. |
O
ref é encaminhado para o elemento raiz.Herança
Embora não explicitamente documentado acima, as propriedades do componente Transition de react-transition-group também estão disponíveis em Collapse. Você pode tirar vantagem disso para manipular componentes aninhados.CSS
| Nome da regra | Classe global | Descrição |
|---|---|---|
| root | .MuiCollapse-root | Estilos aplicados ao elemento raiz. |
| horizontal | .MuiCollapse-horizontal | Pseudo-class aplicada a o elemento raiz se orientation="horizontal". |
| entered | .MuiCollapse-entered | Styles applied to o elemento raiz when the transition has entered. |
| hidden | .MuiCollapse-hidden | Styles applied to o elemento raiz when the transition has exited and collapsedSize = 0px. |
| wrapper | .MuiCollapse-wrapper | Estilos aplicados a the outer wrapper element. |
| wrapperInner | .MuiCollapse-wrapperInner | Estilos aplicados a the inner wrapper element. |
Você pode sobrescrever o estilo do componente usando uma dessas opções de customização:
- Com um nome de classe global.
- Com um nome de regra como parte da propriedade
styleOverridesdo componente em um tema personalizado.