The names changed and there’s no compatibility layer for the old ones, so this is a small migration rather than a version bump. The tables below list every option, method, event and React prop the old packages had and where each one went. They’re typed against both APIs, so if a row is here, it’s current.
Swap the dependency first. page-flip becomes the core package and react-pageflip becomes the React one (which needs the core package beside it, and React 19):
pnpm add @openpageflip/core
yarn add @openpageflip/core
npm i @openpageflip/core @openpageflip/react
pnpm add @openpageflip/core @openpageflip/react
yarn add @openpageflip/core @openpageflip/react
Then the shape of things, which the tables don’t quite say on their own:
new PageFlip(el, opts) followed by loadFromHTML(pages) is one call now, createBook(el, opts). The container’s children are the pages, and the stylesheet is a separate import. The quick start is the full version.
The animated turns return a promise that resolves when the page lands, and the getters became plain properties. Everything the old class exposed for its own internals is gone.
Event names are the same. The handler gets a typed event with the fields named (e.page, e.orientation, e.state) instead of e.data, and on hands back the unsubscribe function.
In React, the ref is the book itself, so ref.current.pageFlip().flipNext() is just ref.current.flipNext(). Pages don’t need refs any more.
Options page-flip OpenPageFlip Notes widthwidthheightheightsizesizeminWidthminWidthmaxWidthmaxWidthminHeightremoved Height follows width by the width:height ratio, so the width bounds are enough. maxHeightremoved Same as minHeight. startPagestartPageflippingTimeflipDurationdrawShadowshadowsmaxShadowOpacityshadowOpacityshowCovercoverusePortraitlayoutusePortrait: false is layout: "spread". The default "auto" picks by container width, and "single" is new. autoSizeautoSizestartZIndexremoved Pages are stacked inside the container, so the book no longer needs a z-index base. mobileScrollSupportremoved The book sets touch-action on itself, so the page scrolls and the book flips without a flag. clickEventForwardignoreDragOnClicks on links, buttons and form fields always reach them. ignoreDragOn is the selector that decides which elements never start a flip. useMouseEventsdragSplit three ways: drag, swipe and click each have their own option. swipeDistanceswipeDistanceshowPageCornershoverCornersdisableFlipByClickclickdisableFlipByClick: true is click: "corners". "off" turns clicks off entirely.
Methods PageFlip OpenPageFlip Notes on()book.on()Returns the unsubscribe function, and takes an AbortSignal in its options. off()book.off()Takes the listener as well as the event name; the old off() dropped every listener of that event. destroy()book.destroy()update()book.update()Resizes are watched for you; call this after other layout changes. loadFromHTML()removed The container's children are the pages when createBook runs, or pass the pages option. updateFromHtml()book.setPages()loadFromImages()removed There is no image mode. Put an img element on each page and it renders like any other content. updateFromImages()removed Same as loadFromImages; use setPages with img pages. clear()removed destroy() restores the DOM; a new book starts from the pages you give it. turnToPrevPage()book.turnPrev()turnToNextPage()book.turnNext()turnToPage()book.turnTo()flipNext()book.flipNext()Resolves when the turn lands, with false when there was nothing to turn to. flipPrev()book.flipPrev()Same promise as flipNext. flip()book.flipTo()Same promise as flipNext. getPageCount()book.pageCountgetCurrentPageIndex()book.pagegetOrientation()book.orientationgetState()book.stategetBoundsRect()book.rectgetSettings()removed Keep your own options object; the book does not hand it back. getPage()removed Internal in the old library. The page elements are the ones you passed in. getRender()removed Internal in the old library. getFlipController()removed Internal in the old library. getUI()removed Internal in the old library. getPageCollection()removed Internal in the old library. updateState()removed Internal in the old library; state is read-only from outside. updatePageIndex()removed Internal in the old library; use turnTo or flipTo. updateOrientation()removed Internal in the old library; the layout option decides orientation. startUserTouch()removed Internal in the old library; pointer input is handled by the book. userMove()removed Same as startUserTouch. userStop()removed Same as startUserTouch.
Events page-flip OpenPageFlip Notes initinite.data.page and e.data.mode are now e.page and e.orientation. updateupdateSame shape as init. flipflipe.data is now e.page. changeStatechangeStatee.data is now e.state. changeOrientationchangeOrientatione.data is now e.orientation.
React props HTMLFlipBook OpenPageFlip Notes onInitonInitHandlers get the core event, see the events table. onUpdateonUpdateonFliponFliponChangeStateonChangeStateonChangeOrientationonChangeOrientationclassNameclassNamestylestylechildrenchildrenChildren are the pages, as before, but they no longer need a ref or forwardRef. Wrap one in Page to make it hard. refrefThe ref is the Book itself, so ref.current.flipNext() replaces ref.current.pageFlip().flipNext(). renderOnlyPageLengthChangeremoved Pages added or removed by React are picked up after every render, and a changed option rebuilds the book on its own.