Next.js Discord

Discord Forum

How to use tailwind elements with nextjs?

Weevil parasitoid posted this in #help-forum
Open in Discord
Weevil parasitoidOP
has anyone used tailwind elements? I want to use it with nextjs with javascript but it doesn't work. I wan to add a navbar and here is my code
const NavBarv2 = () => { useEffect(() => { const init = async () => { const {Navbar, Input, initTE, Dropdown, Collapse} = await import("tw-elements"); const myNavbar = new Navbar( document.getElementById("myNavbar"), ); initTE({ Collapse, Dropdown }); } init(); }, []);
I tried the example give in the official documentation and it works . When i use this code i get the error "TypeError: Navbar is not a constructor"
Also this the navbar code from tailwind elements follows this code

0 Replies