Flipbook
ProNewSupplied page images or React content as a book: a two-page spread with a draggable 3D turn, thumbnails, page field, zoom and full screen. One page at a time on phones; PDF rasterization is up to the consumer.
Installation
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
Props
| Prop | Type | Default |
|---|---|---|
| pages* | FlipbookPage[] | — |
| title | stringDocument name shown above the book and used to name it for screen readers. | — |
| aspect | numberPage width divided by page height. 0.707 is A4 portrait. | 0.707 |
| height | numberTallest the book may get, in pixels. It shrinks to fit narrow containers. | 520 |
| background | stringAny CSS background for the stage behind the book. | "linear-gradient(135deg, #2952c8 0%, #2a86c4 55%, #2bb0ae 100%)" |
| defaultPage | numberPage to open on, counted from 1. | 1 |
| toolbar | booleanShow the toolbar with zoom, thumbnails, page field and full screen. | true |
| maxZoom | numberLargest zoom step. 1 turns zoom off. | 2 |
| singleBelow | numberContainer width, in pixels, below which one page shows at a time. | 600 |
| loading | booleanShows a placeholder book while pages are being prepared. | false |
| onPageChange | (page: number) => voidCalled with the first visible page, counted from 1. | — |
| className | string | — |
Accessibility
- The book is one focusable group: Left and Right or Page Up and Page Down turn the page, Home and End jump to the covers.
- Toolbar buttons and the page field are named; the visible pages are announced politely after every turn.
- Drag or tap the outer edge of a page to turn it; while zoomed the book scrolls instead.
- The thumbnail panel takes focus when it opens, closes with Escape and returns focus to its button.
- Under reduced motion edge dragging swaps pages on release without a rotating leaf; cancel leaves the page unchanged.