tailwindlabs / headlessui

Completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS.
https://headlessui.com
MIT License
26.28k stars 1.09k forks source link

Peer dependency error when upgrading react and react-dom to react 19 (Nextjs 15) #3538

Closed franckadil closed 1 month ago

franckadil commented 1 month ago

What package within Headless UI are you using?

What version of that package are you using?

@headlessui/react: "^2.1.10"

Describe your issue

Upgrading to next.js 15 with the minimum version of react and react-dom that is now 19 I get a peer dependency error that breaks the upgrade. headlessui requires react 18.

stpierrel commented 1 month ago

I couldn't wait, so I went ahead and refactored all the components I had access to. As we know, element.ref access has been removed in React 19, and refs should now be treated as regular props. The stack trace points specifically to some @headlessui/react components, and while I've tackled most of them, there are still two left to refactor regarding this if not mistaking:

reinink commented 1 month ago

Hey folks! We added React 19 support to Headless UI today (see #3543). You can upgrade to this version by running:

npm install @headlessui/react@latest

Please let us know if you run into any issues! 🙏