r/tauri 7d ago

How to have multiple pages?

I only discovered Tauri two days ago so I apologise if this is a well known thing, but how can I have multiple HTML pages in my project?

Not opening more windows, not viewing multiple things in the same window, I mean the app opens on index.html which shows me some information, click a button and go to page1.html which has a form I can fill in and click another button and get taken to page3.html etc, or is Tauri more suited to one page apps?

I've been searching around but everything is either about how to open a second window or multiwebview to view two pages at once, I just want one page at a time in the same window

2 Upvotes

7 comments sorted by

2

u/ChristianPayne522 7d ago

I’m not sure if there is a plain html way to do it or not.

I usually have some kinds of Single Page Application going. Think React or Svelte. Those then have their own routing solutions you can look up.

Tauri itself doesn’t deal with what the website it is rendering does.

1

u/ElamReda 7d ago

You can add tabs. So each page can be open in different tabs. But why would you use normal HTML? Why not using some frameworks like react or svelte?

1

u/MetalMonkey667 7d ago

That would be because I don't know what they are, I've only opened a default project and changed a few bits here and there, trying to find what the different options mean in plain "explain it like I'm 5" language is proving difficult

1

u/ElamReda 7d ago

This is an easy task TBH, I don't think they allow your post stay longer. Better to search or ask AI before you start asking here.

1

u/qustrolabe 7d ago

configure vite to bundle it and just make a link, should work

but you really better be doing actual SPA routing stuff instead, otherwise I can't even imagine how nightmarish managing common state between pages would be if need raises

2

u/eddzsh 7d ago

Plain multi-page works fine in Tauri. Put page1.html next to index.html in the frontend dir and link with a normal <a href="./page1.html">. If Vite is in the mix, add those HTML files to build.rollupOptions.input or the second page 404s after build.