레이아웃과 스타일링을 완전히 제어하며 순차 이벤트를 시각화하는 스타일 없는 타임라인 컴포넌트예요.
출처: 문서
본문
레이아웃과 스타일링을 완전히 제어하며 완전히 커스텀한 타임라인과 이벤트 시퀀스를 만들어 보세요.
기능 (Features)
- 하위 컴포넌트를 갖춘 복합 컴포넌트 API:
Root, Event, Separator, Marker, Connector, Content, Opposite
- 유연한 콘텐츠 배치를 위한 다섯 가지 정렬 모드
- 세로·가로 방향 지원
- 날짜나 타임스탬프 같은 메타데이터를 위한 반대편(opposite) 콘텐츠
사용법 (Usage)
import { Timeline } from 'primereact/timeline';
<Timeline.Root>
<Timeline.Event>
<Timeline.Opposite></Timeline.Opposite>
<Timeline.Separator>
<Timeline.Marker />
<Timeline.Connector />
</Timeline.Separator>
<Timeline.Content></Timeline.Content>
</Timeline.Event>
</Timeline.Root>
동작 (Behavior)
다형성 렌더링 (Polymorphic Rendering)
어느 하위 컴포넌트에서든 as를 사용해 렌더링되는 HTML 요소를 바꿀 수 있어요.
<Timeline.Root as="section"></Timeline.Root>
<Timeline.Content as="article"></Timeline.Content>
기본 요소: Root=div, Event=div, Separator=div, Marker=div, Connector=div, Content=div, Opposite=div.
렌더 함수 children (Render Function Children)
Root는 children으로 렌더 함수를 받아 컴포넌트 인스턴스에 접근할 수 있게 해줘요.
<Timeline.Root align="alternate">{(instance) => <span>Align: {instance.props.align}</span>}</Timeline.Root>
패스 스루 (Pass Through)
<DocPTViewer name="timeline-pt" components={['TimelineRoot']} />
API
TimelineRoot
| Attribute |
Value |
data-scope |
"timeline" |
data-part |
"root" |
data-align |
Current alignment value |
data-orientation |
Current orientation value |
| Label |
Type |
Description |
| root |
TimelineRootPassThroughType<InputHTMLAttributes> |
Used to pass attributes to the root's DOM element. |
| event |
TimelineRootPassThroughType<InputHTMLAttributes> |
Used to pass attributes to the event's DOM element. |
| content |
TimelineRootPassThroughType<InputHTMLAttributes> |
Used to pass attributes to the content's DOM element. |
| opposite |
TimelineRootPassThroughType<InputHTMLAttributes> |
Used to pass attributes to the opposite's DOM element. |
| separator |
TimelineRootPassThroughType<InputHTMLAttributes> |
Used to pass attributes to the separator's DOM element. |
| marker |
TimelineRootPassThroughType<InputHTMLAttributes> |
Used to pass attributes to the marker's DOM element. |
| connector |
TimelineRootPassThroughType<InputHTMLAttributes> |
Used to pass attributes to the connector's DOM element. |
TimelineEvent
| Attribute |
Value |
data-scope |
"timeline" |
data-part |
"event" |
| Label |
Type |
Description |
| root |
TimelineEventPassThroughType<HTMLAttributes> |
Used to pass attributes to the root's DOM element. |
TimelineSeparator
| Attribute |
Value |
data-scope |
"timeline" |
data-part |
"separator" |
| Label |
Type |
Description |
| root |
TimelineSeparatorPassThroughType<HTMLAttributes> |
Used to pass attributes to the root's DOM element. |
TimelineMarker
| Attribute |
Value |
data-scope |
"timeline" |
data-part |
"marker" |
| Label |
Type |
Description |
| root |
TimelineMarkerPassThroughType<HTMLAttributes> |
Used to pass attributes to the root's DOM element. |
TimelineConnector
| Attribute |
Value |
data-scope |
"timeline" |
data-part |
"connector" |
| Label |
Type |
Description |
| root |
TimelineConnectorPassThroughType<HTMLAttributes> |
Used to pass attributes to the root's DOM element. |
TimelineContent
| Attribute |
Value |
data-scope |
"timeline" |
data-part |
"content" |
| Label |
Type |
Description |
| root |
TimelineContentPassThroughType<HTMLAttributes> |
Used to pass attributes to the root's DOM element. |
TimelineOpposite
| Attribute |
Value |
data-scope |
"timeline" |
data-part |
"opposite" |
| Label |
Type |
Description |
| root |
TimelineOppositePassThroughType<HTMLAttributes> |
Used to pass attributes to the root's DOM element. |
접근성 (Accessibility)
스크린 리더 (Screen Reader)
Timeline은 이벤트 구조에 의미론적 컨테이너를 사용해요. 타임라인 용도를 설명하려면 루트에 aria-label을 추가해요. 이벤트 콘텐츠는 문서 순서대로 읽혀요.
<Timeline.Root aria-label="Order tracking timeline"></Timeline.Root>
키보드 지원 (Keyboard Support)
해당 없음. Timeline은 표현용 컴포넌트로, 키보드 상호작용은 이벤트 안에 렌더링된 상호작용 콘텐츠에 달려 있어요.
더 알아보기 (Learn more)