Paginator
Paginator는 데이터를 페이지 단위로 보여주고 페이지 사이를 이동할 수 있게 해주는 컴포넌트예요. 목록이 길어질 때 전체를 한 번에 보여주는 대신, 페이지로 나눠서 탐색하게 하고 싶다면 쓰기 좋아요.
출처: 문서
본문
사용법 (Usage)
import { Paginator } from '@primereact/ui/paginator';
<Paginator.Root>
<Paginator.Content>
<Paginator.First />
<Paginator.Prev />
<Paginator.Pages />
<Paginator.Next />
<Paginator.Last />
</Paginator.Content>
</Paginator.Root>
예시 (Examples)
기본 (Basic)
total prop으로 전체 항목 수를, itemsPerPage로 페이지당 항목 수를 정의해요.
형제 (Siblings)
siblings prop으로 표시할 형제 페이지 수를 정의해요. 형제(siblings)란 현재 페이지 앞뒤로 표시되는 페이지 수를 말해요.
가장자리 (Edges)
edges prop으로 표시할 가장자리 페이지 수를 정의해요. 가장자리(edges)란 paginator의 처음과 끝에 표시되는 페이지 수예요.
생략 표시 (Show Ellipsis)
showEllipsis prop으로 생략 부호(ellipsis)를 표시할지 정의해요. showEllipsis가 false이면 edges prop은 무시돼요.
템플릿 (Template)
다음은 paginator 안에 어떤 순서로든 배치할 수 있는 요소 목록이에요.
커스텀 텍스트 (Custom Text)
onPageChange 이벤트로 표시할 커스텀 텍스트를 정의할 수 있어요.
커스터마이징 (Customization)
요소에 child로 아이콘을 전달하면 기본 아이콘을 덮어쓰거나, className으로 요소를 커스터마이즈할 수 있어요.
입력과 함께 (With Input)
관련 문서 (Related)
서브 컴포넌트 (Sub-Components)
서브 컴포넌트의 props, state, exposes, 데이터 속성은 Primitive API에서 확인하세요.
훅 (Hooks)
usePaginator 훅 인터페이스는 Headless API에서 확인하세요.
접근성 (Accessibility)
WAI-ARIA 준수 세부사항과 키보드 지원은 Paginator Primitive에서 확인하세요.
테마 (Theming)
CSS 클래스 (CSS Classes)
styled 모드에서 사용하는 클래스 이름 목록이에요.
| ClassName | Description |
|---|---|
| p-paginator | Class name of the paginator element |
| p-paginator-content-start | Class name of the content start element |
| p-paginator-content-end | Class name of the content end element |
| p-paginator-first | Class name of the first element |
| p-paginator-first-icon | Class name of the first icon element |
| p-paginator-prev | Class name of the prev element |
| p-paginator-prev-icon | Class name of the prev icon element |
| p-paginator-next | Class name of the next element |
| p-paginator-next-icon | Class name of the next icon element |
| p-paginator-last | Class name of the last element |
| p-paginator-last-icon | Class name of the last icon element |
| p-paginator-pages | Class name of the pages element |
| p-paginator-page | Class name of the page element |
| p-paginator-current | Class name of the current element |
| p-paginator-rpp-dropdown | Class name of the row per page dropdown element |
| p-paginator-jtp-dropdown | Class name of the jump to page dropdown element |
| p-paginator-jtp-input | Class name of the jump to page input element |
디자인 토큰 (Design Tokens)
디자인 토큰 목록이에요.
| Token | CSS Variable | Description |
|---|---|---|
| paginator.padding | --p-paginator-padding | Padding of root |
| paginator.gap | --p-paginator-gap | Gap of root |
| paginator.border.radius | --p-paginator-border-radius | Border radius of root |
| paginator.background | --p-paginator-background | Background of root |
| paginator.color | --p-paginator-color | Color of root |
| paginator.transition.duration | --p-paginator-transition-duration | Transition duration of root |
| paginator.nav.button.background | --p-paginator-nav-button-background | Background of nav button |
| paginator.nav.button.hover.background | --p-paginator-nav-button-hover-background | Hover background of nav button |
| paginator.nav.button.selected.background | --p-paginator-nav-button-selected-background | Selected background of nav button |
| paginator.nav.button.color | --p-paginator-nav-button-color | Color of nav button |
| paginator.nav.button.hover.color | --p-paginator-nav-button-hover-color | Hover color of nav button |
| paginator.nav.button.selected.color | --p-paginator-nav-button-selected-color | Selected color of nav button |
| paginator.nav.button.width | --p-paginator-nav-button-width | Width of nav button |
| paginator.nav.button.height | --p-paginator-nav-button-height | Height of nav button |
| paginator.nav.button.border.radius | --p-paginator-nav-button-border-radius | Border radius of nav button |
| paginator.nav.button.font.weight | --p-paginator-nav-button-font-weight | Font weight of nav button |
| paginator.nav.button.font.size | --p-paginator-nav-button-font-size | Font size of nav button |
| paginator.nav.button.focus.ring.width | --p-paginator-nav-button-focus-ring-width | Focus ring width of nav button |
| paginator.nav.button.focus.ring.style | --p-paginator-nav-button-focus-ring-style | Focus ring style of nav button |
| paginator.nav.button.focus.ring.color | --p-paginator-nav-button-focus-ring-color | Focus ring color of nav button |
| paginator.nav.button.focus.ring.offset | --p-paginator-nav-button-focus-ring-offset | Focus ring offset of nav button |
| paginator.nav.button.focus.ring.shadow | --p-paginator-nav-button-focus-ring-shadow | Focus ring shadow of nav button |
| paginator.current.page.report.color | --p-paginator-current-page-report-color | Color of current page report |
| paginator.current.page.report.font.weight | --p-paginator-current-page-report-font-weight | Font weight of current page report |
| paginator.current.page.report.font.size | --p-paginator-current-page-report-font-size | Font size of current page report |
| paginator.jump.to.page.input.max.width | --p-paginator-jump-to-page-input-max-width | Max width of jump to page input |
더 알아보기 (Learn more)
- Paginator 서브 컴포넌트의 세부 API를 Primitive 문서에서 살펴보세요.
siblings와edges를 조합해 생략 부호가 적절히 나타나는 페이지 레이아웃을 만들어 보세요.