Avara UI

Book Flip

An interactive 3D Book Flip component simulating realistic book page turns, dynamic spine shifts, center fold shadows, leaf peeking, and bottom icon toolbar controls.

Variations

Book Flip Component

Interactive 3D book cover, open spreads with center spine fold shadow, leaf peeking, and icon-only navigation controls.

Installation

New project? Follow the installation guide to set up Tailwind CSS, shadcn, the cn helper and lucide-react, register the @algorize-ui registry once, then copy your styles from the Themes page.

Install Book Flip

npx shadcn@latest add @algorize-ui/book-flip

components/custom/book-flip.tsx is written into your project. Copy any snippet from a Usage tab above and it runs.

Install dependencies

Nothing beyond the shared setup — Book Flip needs only the cn helper and lucide-react, which the installation guide already put in place.

Features

  • 3D Book Cover & Spread Transition: Starts in single-cover mode and dynamically centers into a 2-page spread upon flipping leaves.
  • Center Spine Crease Shadow: Realistic crease fold shadow integrated on page surfaces.
  • Keyboard Navigation: Press Left Arrow (←) and Right Arrow (→) keys to flip through pages.
  • Minimal Icon Toolbar: Features < Prev, Reset, X / Y counter, and Next > icon-only controls.

Props Reference: BookFlip

PropTypeDefaultDescription
pagesPageFlipLeaf[]DEFAULT_PAGESArray of page leaves, each containing front and back images & metadata.
turnedIndexnumberundefinedControlled turned page count.
defaultTurnedIndexnumber0Default turned page count (0 = closed cover).
onPageChange(turnedCount: number, totalLeaves: number) => voidundefinedCallback fired when page count changes.
pageWidthnumber260Width of a single page leaf in pixels.
pageHeightnumber380Height of a single page leaf in pixels.
showControlsbooleantrueToggles visibility of the bottom navigation controls toolbar.
showSpineBindingbooleantrueToggles outer book spine crease line overlay.
showPageNumbersbooleantrueToggles page numbering badges on leaves.
autoplaybooleanfalseEnables automatic page flipping timer.
autoplayIntervalnumber3500Interval in milliseconds between automatic page flips.