포털
포털 (Portal)
포털은 일반적인 DOM 계층 구조 밖에 콘텐츠를 렌더링하는 컴포넌트예요.
출처: 문서
본문
Portal 컴포넌트
일반적인 DOM 계층 구조 밖에 콘텐츠를 렌더링하는 컴포넌트예요.
- Keywords: portal, render, dom, mount, teleport
- Categories: utility
- Status: general-availability
예시
import Portal from '@atlaskit/portal/portal';
const Examples = (): React.JSX.Element => (
<>
<Portal>
<div>This content is rendered in a portal</div>
</Portal>
<Portal zIndex={1000}>
<div>This content has a custom z-index</div>
</Portal>
</>
);
export default Examples;
Props
| Prop | Type | Description |
|---|---|---|
children |
string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
(required) |
mountStrategy |
"effect" | "layoutEffect" |
Specify the mount strategy: useEffect or useLayoutEffect |
zIndex |
string | number |
사용 지침
- 일반적인 DOM 밖의 콘텐츠 렌더링에 사용해요
- z-index와 위치 지정(positioning)을 고려해요
- 포커스 관리를 적절히 처리해요
- 모달과 오버레이에 사용해요
콘텐츠 지침
- 포털로 렌더링된 콘텐츠가 접근 가능하도록 해요
- 콘텐츠의 맥락과 목적을 고려해요
- 적절한 포털 배치를 사용해요
접근성 지침
- 올바른 포커스 관리를 보장해요
- 스크린 리더 접근성을 고려해요
- 적절한 ARIA 속성을 사용해요
- 키보드 탐색을 처리해요