Layouts overview

The page frames the engine ships, which ones you can replace, and how.

Framework: TanStack Start

This page is written for TanStack Start, the default and currently supported framework. See what depends on the framework.

Every page the engine draws sits inside a frame: a header on top, a footer at the bottom, and a few global pop-ups (login, offers, branches). Account pages get one extra frame on the left: the account menu.

That is all there is. Two frames, both replaceable:

FrameWhere you see itReplace it by
MasterLayoutEvery page: header, footer, global modalsThe layout prop of TwilightProvider in app/routes/__root.tsx
CustomerLayoutOnly /account pages: the menu on the leftYour own account route in app/routes.ts

What a customer sees

/product-name/p123
HeaderMasterLayout
Announcement bar, logo, menu, search, cart
The page: a route you can replace
FooterMasterLayout
Links, apps, copyright
Pop-ups, shown on demand: login, offers, branch pickerMasterLayout
Slot: add your content hereDrawn by the engine
Any page (home, product, cart, blog...)

The header and footer are the same on both. The only difference is that CustomerLayout wraps the account page with the menu and the title.

Inside MasterLayout the header and footer are separate pieces you can swap one at a time: Header, Footer, PageAdvertisements and WidgetHead.

I want to change... what do I do?

I want toDo thisEffort
Add a banner or a tracking snippet in the header or footerFill a slot: header:start, footer:end...A few lines, keeps every engine update
Use my own header or footerWrite your own Header / Footer and a layout that uses them. StepsYou own that part
Change the whole framePass layout={YourLayout} to TwilightProvider. You also bring the global modalsYou own the frame
Change the account menu or titleReplace the /account route. StepsYou own the account area
Draw no frame at alllayout={false}Only if something else draws it

Start at the top of the table and only go down when you must.

layout={false} removes the header, the footer and the login modal from every page.

Hooks that help you style a layout

  • Every page sets a class on <body> for its route, so you can scope styles to one page. CustomerLayout adds customer to every account page. See Styling.
  • useDocumentClass lets your own layout add classes to <html> or <body>.

Next

On this page