본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Grow API

원문 보기 위키 갱신

Grow API (그로우 트랜지션 API)

Grow는 자식 요소가 나타날 때(마운트될 때) 비율과 크기가 커지면서 등장하는 트랜지션 컴포넌트예요. 이 페이지에서는 이 컴포넌트의 props, CSS, 그리고 기타 API를 하나씩 설명해 드릴게요.

출처: 문서

본문

데모 (Demos)

이 React 컴포넌트의 사용법과 세부 사항은 컴포넌트 데모 페이지에서 확인할 수 있어요.

  • Popover
  • Transitions

Import

import Grow from '@mui/material/Grow';
// 또는
import { Grow } from '@mui/material';

번들 크기를 줄이는 방법이 궁금하시다면, 이 차이에 대한 가이드 문서를 읽어 보시면 좋아요.

Grow 트랜지션은 Tooltip과 Popover 컴포넌트에서도 사용돼요.

Props

Transition 컴포넌트의 props도 그대로 사용할 수 있어요.

Name Type Default Description
children * - A single child content element. This needs to be able to hold a ref.
addEndListener func - Add a custom transition end trigger. Use it when you need custom logic to decide when the transition has ended. Note: Timeouts are still used as a fallback if provided. Signature: function(node: HTMLElement, done: Function) => void. node The transitioning DOM node. done Call this when the transition has finished.
appear bool true Perform the enter transition when it first mounts if in is also true. Set this to false to disable this behavior.
disablePrefersReducedMotion bool false If true, the transition ignores theme.motion.reducedMotion and keeps its normal timing.
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 - If true, the component will transition in.
timeout 'auto'| number| { appear?: number, enter?: number, exit?: number } 'auto' 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.

ref는 루트 요소로 전달돼요.

상속 (Inheritance)

위에서 명시적으로 다루지는 않았지만, react-transition-group의 Transition 컴포넌트 props도 Grow에서 사용할 수 있어요. 이를 활용해 중첩된 컴포넌트를 대상으로 지정할 수 있어요.

소스 코드 (Source code)

이 페이지에서 원하는 정보를 찾지 못했다면, 컴포넌트의 구현 코드를 살펴보시면 더 자세한 내용을 확인할 수 있어요.

더 알아보기