Book CarouselBook Carousel
An open book with soft, flexible 3D page flips. Pages can be images, videos or any React component, and one image can span both sides of a spread.

















1 / 6
Installation
- 1
Install the component:
npx shadcn@latest add https://ui.amines.fun/registry/book-carousel.json - 2
Usage:
jsxapp/page.jsx
1const pages = [2 "/bgs/pt1.jpg",3 "/bgs/pt2.jpg",4 { src: "/bg2.jpg", spread: true },5 "/bgs/pt4.jpg",6 "/bgs/pt5.jpg",7];89<BookCarousel pages={pages} pageRatio={0.75} maxWidth={860} flipDuration={1100} bendStrength={1.1} />
Props
| Prop | Type | Default | Description | Required |
|---|---|---|---|---|
| pages | (string | ReactElement | ((page: { active: boolean, side: "left" | "right", index: number }) => ReactNode) | { src: string, alt?: string, fit?: "cover" | "contain", position?: string } | { video: string, poster?: string, loop?: boolean, muted?: boolean, autoPlay?: boolean, controls?: boolean, fit?: "cover" | "contain", position?: string } | { content: ReactNode | ((page: { active: boolean, side: "left" | "right", index: number }) => ReactNode) } | ({ ...item, spread: true }) | null)[] | [] | Flat page list, laid out two per spread; an odd count gets a trailing blank. Each item may be an image URL string, any React element, a render function ({ active, side, index }) => node, an image object { src, alt?, fit?, position? }, a video object { video, poster?, loop?, muted?, autoPlay?, controls?, fit?, position? } that plays only while its page is visible, a { content } object for custom content, or null for a blank page. Add spread: true to any object item to lay it across both pages of a spread (auto-aligned to a left page). Every object item also accepts className and style for that page's paper. | No |
| pageRatio | number | 0.75 | Width / height of ONE page. The book's height comes from its width and this ratio. | No |
| maxWidth | number | string | 960 | Max width of the book — a px number or any CSS length. The book fills its parent's width up to this. | No |
| coverThickness | number | 0.03 | 0–0.1. Cover border as a fraction of the book width. The page stacks are drawn inside this border, so keep it at 0.02 or more to see them. 0 removes the cover and the stacks. | No |
| blankFirst | boolean | false | Start with an empty left page, so the first content page sits alone on the right like a real book. | No |
| bend | number | 6 | Strips per curling sheet. More = smoother curve with a little more work. Below 2 = no curling. | No |
| bendStrength | number | 1 | How much the paper flexes and wobbles. 0 = stiff, 1 = normal, ~1.5 = floppy. Forced to 0 under prefers-reduced-motion. | No |
| showStack | boolean | true | Show the sheets piled under both halves of the book; they peel away one by one as you turn. | No |
| stackSheets | number | 8 | Max visible stacked sheets per side. | No |
| flipDuration | number | 1000 | ms. Duration of one page flip. 0 (or prefers-reduced-motion) snaps pages instantly. | No |
| easing | [number, number, number, number] | string | [0.65, 0, 0.35, 1] | Framer Motion ease — a cubic-bezier array or a named ease like "easeInOut". | No |
| index | number | - | Controlled spread index (0 = first spread). Pair with onChange. | No |
| defaultIndex | number | 0 | Initial spread when uncontrolled. | No |
| onChange | (index: number, prevIndex: number) => void | - | Fires when a flip starts. | No |
| onFlipEnd | (index: number) => void | - | Fires when all pages have landed. | No |
| autoPlay | boolean | false | Flip automatically. Pauses when the book is off-screen or the tab is hidden. | No |
| autoPlayDelay | number | 4000 | ms between flips, counted after the previous flip lands. | No |
| loop | boolean | true | At the last spread, autoplay flips back to the first one. If false, autoplay stops there. | No |
| pauseOnHover | boolean | true | Pause autoplay while the mouse is over the book. | No |
| showControls | boolean | true | Prev / next buttons under the book. | No |
| showCounter | boolean | true | "1 / 5" counter between the buttons. | No |
| keyboard | boolean | true | Arrow ←/→ and Home/End flip pages while the book is focused. | No |
| swipe | boolean | true | Swipe / drag sideways to flip. | No |
| edgeClick | boolean | true | Click the outer edge of a page to flip. Turn off if your pages contain buttons or links near their edges. | No |
| preload | number | 2 | How many spreads on each side of the current one keep their pages mounted. | No |
| className | string | "" | Classes for the outer wrapper. | No |
| coverClassName | string | "bg-[#86613a] dark:bg-[#4a3826]" | Cover colors (replaces the default). | No |
| pageClassName | string | "bg-[#fbfaf5] dark:bg-neutral-800" | Paper colors (replaces the default). | No |
| stackClassName | string | "bg-[#ece8db] dark:bg-neutral-700" | Stacked-sheet colors (replaces the default). | No |
| controlsClassName | string | "" | Classes for the controls row. | No |
| ariaLabel | string | "Book" | Accessible name for the book region. | No |
| ref | Ref<{ next(): void, prev(): void, goTo(i: number): void, play(): void, pause(): void, toggle(): void, getIndex(): number, spreadCount: number }> | - | Imperative API: next() / prev() flip one spread, goTo(i) jumps to spread i (multi-spread jumps flip in a quick stagger), play() / pause() / toggle() drive autoplay, getIndex() returns the current spread index, spreadCount is the total number of spreads. | No |