T
TanStack2y ago
exotic-emerald

Multiple layouts

I trying to achieve the following and I'm not sure if it's possible. I would like the home page of the application as well as most of the other routes to share a common layout, but for a particular path and it's children to have a completely different layout. Imagine the majority of the pages have an unauthenticated layout but a select few use an authenticated layout.
4 Replies
xenial-black
xenial-black2y ago
Could you maybe describe the URLs you are trying to achieve, and which routes are nested with something else.
extended-salmon
extended-salmon17mo ago
Im tryiung to archive the same @Sean Cassiere I would say. /login ---> to have no layout (or empty layout?) / ---> main layout /tickets / ---> main layout I don't see anything in the docs related to multiple layoutss. I guess, I could use a hack with the <Outlet /> but first wanted to know if there are specifics solutions for this.
xenial-black
xenial-black17mo ago
Using multiple layouts are easy. Its just a matter of naming your files like this.
src/routes
_my-layout/
index.tsx
tickets.tsx
_my-layout.tsx
_some-other-layout/
login.tsx
_some-other-layout.tsx
a-route-outside-of-all-layouts.tsx
src/routes
_my-layout/
index.tsx
tickets.tsx
_my-layout.tsx
_some-other-layout/
login.tsx
_some-other-layout.tsx
a-route-outside-of-all-layouts.tsx
This generates the following URLs. - / - /tickets - /login - /a-route-outside-of-all-layouts
extended-salmon
extended-salmon17mo ago
Thanks! Appreciate it!

Did you find this page helpful?