Gallery
이미지 컬렉션을 갤러리 형태로 표시하는 컴포넌트예요. 라이트박스 뷰어, 툴바, 썸네일 등을 지원해요.
출처: 문서
본문
Gallery는 갤러리 형태로 이미지 컬렉션을 표시하는 컴포넌트예요.
사용법 (Usage)
import { Gallery } from '@primereact/ui/gallery';
<Gallery.Root>
<Gallery.Backdrop />
<Gallery.Prev></Gallery.Prev>
<Gallery.Next></Gallery.Next>
<Gallery.Header>
<Gallery.RotateLeft></Gallery.RotateLeft>
<Gallery.RotateRight></Gallery.RotateRight>
<Gallery.ZoomIn></Gallery.ZoomIn>
<Gallery.ZoomOut></Gallery.ZoomOut>
<Gallery.FlipX></Gallery.FlipX>
<Gallery.FlipY></Gallery.FlipY>
<Gallery.Download></Gallery.Download>
<Gallery.FullScreen></Gallery.FullScreen>
</Gallery.Header>
<Gallery.Content>
<Gallery.Item></Gallery.Item>
</Gallery.Content>
<Gallery.Footer>
<Gallery.Thumbnail>
<Gallery.ThumbnailContent>
<Gallery.ThumbnailItem></Gallery.ThumbnailItem>
</Gallery.ThumbnailContent>
</Gallery.Thumbnail>
</Gallery.Footer>
</Gallery.Root>
예제 (Examples)
기본 (Basic)
라이트박스 뷰어로 이미지 컬렉션을 표시해요.
툴바 (Toolbar)
Gallery.Header에 RotateLeft, ZoomIn, Download, FullScreen 같은 액션 하위 컴포넌트를 추가해 이미지 컨트롤을 노출해요.
썸네일 (Thumbnails)
Gallery.Footer에 Gallery.Thumbnail을 추가하면 빠른 탐색을 위한 썸네일 스트립을 렌더링해요.
단일 (Single)
썸네일이나 내비게이션 버튼 없이, 이미지를 클릭하면 전체 화면 대화상자로 열려요.
그리드 (Grid)
관련 자료 (Related)
하위 컴포넌트 (Sub-Components)
GalleryRoot, GalleryContent, GalleryItem, GalleryPrev, GalleryNext, GalleryHeader, GalleryFooter, GalleryBackdrop, GalleryThumbnail, GalleryThumbnailContent, GalleryThumbnailItem 및 액션 컴포넌트 문서는 Primitive API에서 확인할 수 있어요.
훅 (Hooks)
useGallery 훅 문서는 Headless API에서 확인할 수 있어요.
접근성 (Accessibility)
WAI-ARIA 준수 상세와 키보드 지원은 Gallery Primitive에서 확인할 수 있어요.
테마 (Theming)
CSS 클래스 (CSS Classes)
styled 모드에서 사용하는 클래스 이름 목록이에요.
| ClassName | Description |
|---|---|
| p-gallery | Class name of the root element |
| p-gallery-backdrop | Class name of the backdrop element |
| p-gallery-header | Class name of the header element |
| p-gallery-footer | Class name of the footer element |
| p-gallery-content | Class name of the content element |
| p-gallery-item | Class name of the item element |
| p-gallery-next | Class name of the next element |
| p-gallery-prev | Class name of the prev element |
| p-gallery-action | Class name of the action element |
| p-gallery-action | Class name of the zoom in element |
| p-gallery-action | Class name of the zoom out element |
| p-gallery-action | Class name of the zoom toggle element |
| p-gallery-action | Class name of the rotate left element |
| p-gallery-action | Class name of the rotate right element |
| p-gallery-action | Class name of the flip x element |
| p-gallery-action | Class name of the flip y element |
| p-gallery-action | Class name of the download element |
| p-gallery-action | Class name of the full screen element |
| p-gallery-thumbnail | Class name of the thumbnail element |
| p-gallery-thumbnail-content | Class name of the thumbnail content element |
| p-gallery-thumbnail-item | Class name of the thumbnail item element |
디자인 토큰 (Design Tokens)
디자인 토큰 목록이에요.
| Token | CSS Variable | Description |
|---|---|---|
| gallery.backdrop.background | --p-gallery-backdrop-background | Background of backdrop |
| gallery.header.padding | --p-gallery-header-padding | Padding of header |
| gallery.header.background | --p-gallery-header-background | Background of header |
| gallery.footer.padding | --p-gallery-footer-padding | Padding of footer |
| gallery.footer.background | --p-gallery-footer-background | Background of footer |
| gallery.footer.border.color | --p-gallery-footer-border-color | Border color of footer |
| gallery.item.transition.duration | --p-gallery-item-transition-duration | Transition duration of item (transform and opacity) |
| gallery.action.size | --p-gallery-action-size | Size of action (shared by action / next / prev) |
| gallery.action.border.radius | --p-gallery-action-border-radius | Border radius of action |
| gallery.action.color | --p-gallery-action-color | Color of action |
| gallery.action.hover.background | --p-gallery-action-hover-background | Hover background of action |
| gallery.action.hover.color | --p-gallery-action-hover-color | Hover color of action |
| gallery.action.disabled.opacity | --p-gallery-action-disabled-opacity | Disabled opacity of action |
| gallery.action.transition.duration | --p-gallery-action-transition-duration | Transition duration of action |
| gallery.action.icon.size | --p-gallery-action-icon-size | Icon size of action |
| gallery.navigation.background | --p-gallery-navigation-background | Background of navigation (next / prev) |
| gallery.navigation.size | --p-gallery-navigation-size | Size of navigation |
| gallery.navigation.border.radius | --p-gallery-navigation-border-radius | Border radius of navigation |
| gallery.navigation.color | --p-gallery-navigation-color | Color of navigation |
| gallery.navigation.hover.background | --p-gallery-navigation-hover-background | Hover background of navigation |
| gallery.navigation.hover.color | --p-gallery-navigation-hover-color | Hover color of navigation |
| gallery.navigation.offset | --p-gallery-navigation-offset | Edge offset of navigation |
| gallery.navigation.transition.duration | --p-gallery-navigation-transition-duration | Transition duration of navigation |
| gallery.navigation.icon.size | --p-gallery-navigation-icon-size | Icon size of navigation |
| gallery.thumbnail.size | --p-gallery-thumbnail-size | Size of thumbnail item |
| gallery.thumbnail.padding | --p-gallery-thumbnail-padding | Padding of thumbnail item |
| gallery.thumbnail.background | --p-gallery-thumbnail-background | Background of thumbnail item |
| gallery.thumbnail.border.radius | --p-gallery-thumbnail-border-radius | Border radius of thumbnail item |
| gallery.thumbnail.border.width | --p-gallery-thumbnail-border-width | Border width of thumbnail item (outline width) |
| gallery.thumbnail.hover.border.color | --p-gallery-thumbnail-hover-border-color | Hover border color of thumbnail item |
| gallery.thumbnail.active.border.color | --p-gallery-thumbnail-active-border-color | Active border color of thumbnail item |
| gallery.thumbnail.active.scale | --p-gallery-thumbnail-active-scale | Active scale of thumbnail item |
| gallery.thumbnail.transition.duration | --p-gallery-thumbnail-transition-duration | Transition duration of thumbnail item |
| gallery.thumbnail.content.padding | --p-gallery-thumbnail-content-padding | Padding of thumbnail content |