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

스플리터 (Splitter)

원문 보기 위키 갱신

포인터와 키보드 기반 크기 조절이 가능한 스타일 없는 리사이저블 패널 레이아웃 컴포넌트예요.

출처: 문서

본문

Features (기능)

  • 하위 컴포넌트(Root, Panel, Gutter, Handle)를 갖춘 컴파운드 API예요.
  • 키보드 화살표 키를 위한 설정 가능한 step을 가진 포인터 기반 드래그 리사이징이에요.
  • minSize, maxSize, collapsible, collapsedSize를 통한 패널 제약이에요.
  • 복잡한 다방향 레이아웃을 위한 중첩 스플리터 지원이에요.

Usage (사용법)

import { Splitter } from 'primereact/splitter';
<Splitter.Root>
    <Splitter.Panel></Splitter.Panel>
    <Splitter.Gutter>
        <Splitter.Handle />
    </Splitter.Gutter>
    <Splitter.Panel></Splitter.Panel>
</Splitter.Root>

Behavior (동작)

다형성 렌더링 (Polymorphic Rendering)

어떤 하위 컴포넌트든 as를 써서 렌더링되는 HTML 요소를 바꿀 수 있어요.

<Splitter.Root as="section">
    <Splitter.Panel as="main">...</Splitter.Panel>
</Splitter.Root>

렌더 함수 children (Render Function Children)

하위 컴포넌트는 children으로 렌더 함수를 받아 컴포넌트 인스턴스에 접근할 수 있게 해줘요.

<Splitter.Panel>{(instance) => <div>{instance.props.minSize}</div>}</Splitter.Panel>

API

SplitterRoot

Attribute Value
data-orientation "horizontal" or "vertical"
data-resizing Present during a resize operation
data-disabled Present when disabled
Label Type Description
root SplitterRootPassThroughType<HTMLAttributes> Used to pass attributes to the root's DOM element.
panel SplitterRootPassThroughType<HTMLAttributes> Used to pass attributes to the panel's DOM element.
gutter SplitterRootPassThroughType<HTMLAttributes> Used to pass attributes to the gutter's DOM element.
handle SplitterRootPassThroughType<HTMLAttributes> Used to pass attributes to the handle's DOM element.

SplitterPanel

Attribute Value
data-orientation "horizontal" or "vertical"
data-index Panel index number
data-resizing Present during a resize operation
Label Type Description
root SplitterPanelPassThroughType<HTMLAttributes> Used to pass attributes to the root's DOM element.

SplitterGutter

Attribute Value
data-orientation "horizontal" or "vertical"
data-resizing Present during a resize operation
data-disabled Present when disabled
Label Type Description
root SplitterGutterPassThroughType<HTMLAttributes> Used to pass attributes to the root's DOM element.

SplitterHandle

Attribute Value
data-orientation "horizontal" or "vertical"
data-resizing Present during a resize operation
Label Type Description
root SplitterHandlePassThroughType<HTMLAttributes> Used to pass attributes to the root's DOM element.

Accessibility (접근성)

스크린 리더 (Screen Reader)

Splitter gutter는 role을 separator로 정의하고 aria-orientation을 가로 또는 세로로 설정해요. 각 gutter는 패널 크기를 전달하기 위한 aria-valuenow, aria-valuemin, aria-valuemax를 제공해요. 인접한 패널은 aria-controls로 연결돼요.

키보드 지원 (Keyboard Support)

Key Function
tab Moves focus through the splitter bar.
down arrow Moves a vertical splitter down.
up arrow Moves a vertical splitter up.
left arrow Moves a horizontal splitter to the left.
right arrow Moves a horizontal splitter to the right.

더 알아보기 (Learn more)