Extension pages
Your extension has pages of its own, next to the UI it injects into other
sites. WXT turns every folder in apps/extension/entrypoints/ into a
manifest entry. You never edit manifest.json.
What ships
Section titled “What ships”| Page | Opens | Renders | Module |
|---|---|---|---|
popup | toolbar icon click | Home (your feature), Account and Settings tabs | core |
sidepanel | Chrome’s side panel menu | the same tabs, docked, full height | sidepanel |
On-page UI (the demo’s status card on every https page, while your clone keeps it) is a different kind of surface, covered in On-page UI. The welcome page every install opens lives on your website (below).
The popup and the side panel are one screen
Section titled “The popup and the side panel are one screen”Both pages mount the same page, mountHub in components/HubPage.tsx:
the hub, AccountHub, with your feature as its child.
<AppProviders> <BroadcastBanner /> <AccountHub> <YourFeature /> </AccountHub> <PaywallOverlay /></AppProviders>AccountHub (components/account/AccountHub.tsx) is three tabs. Home
is your feature and opens first, for guests and signed-in users alike,
so a free feature is never behind sign-in; its label is tabs.home in
site.config.ts, so name it after your product. Account is the profile
row, the plan row, and the menu. The plan row names the plan with a status
chip (Trial, Active, Payment issue, Canceled, Lifetime) and the date that
matters, and has one action: Upgrade opens the plan picker (the same
dialog a paywall opens), Manage billing opens the portal. Settings live here, in
the surface the user already has open; there is no separate options
page. What a signed-out user sees first is one setting, auth.signIn in
site.config.ts (Authentication): the tabs on Home, or
the sign-in form with your feature below it.
The differences are layout only. The popup sizes to its content. The side
panel is as tall as the window, so mountHub("sidepanel") wraps the hub in
a min-h-screen flex column. Keep that wrapper when you change the page.
The toolbar icon opens the popup. Chrome lists the side panel in its
side panel menu. To make the icon open the side panel instead, delete
entrypoints/popup/: the background already asks for that behavior
(sidePanel.setPanelBehavior({ openPanelOnActionClick: true }) in
background/index.ts), and a popup takes precedence only while one
exists.
Popup-only product? Answer no to the setup wizard’s Side panel
question, the default. Firefox builds show the same page in Firefox’s
sidebar instead (WXT writes it as sidebar_action): the side panel API is
Chromium-only, so the Firefox manifest filters the sidePanel permission.
The welcome page
Section titled “The welcome page”background/index.ts opens your website’s welcome page in a new tab when
runtime.onInstalled fires with reason install. It lives on the website,
not in the extension, because an extension page can’t load an analytics
script: on your site, every install shows up in your analytics.
The site template (apps/site) ships the page at /welcome/: three cards
(pin the icon, open the popup, find Settings), each with a small sketch of
that UI, on one screen with no scroll, kept out of search results. The
copy is in apps/site/src/pages/welcome.astro. The extension opens the
address in urls.welcome in site.config.ts, which the setup wizard’s
Firebase step fills with your Hosting site; set it by hand for any other
address:
urls: { welcome: "https://example.com/welcome/",},Install opens that URL with ?v=<version>&b=<browser> appended, nothing
that identifies the user; pnpm dev builds send v=dev, so your own
restarts can be filtered out. The content script stays off that page, like
it stays off checkout. An empty urls.welcome opens no page.
Add a page
Section titled “Add a page”In Claude Code, /add-surface stats page does all of this
(With AI agents). By hand:
- Create
entrypoints/stats/index.html, copied fromentrypoints/popup/, and amain.tsx. The folder name becomes the file name:stats.html. - Keep the three things every page needs:
import ReactDOM from "react-dom/client";import "~/assets/tailwind.css";import "@extensionstart/ui/fonts.css";import AppProviders from "@/components/AppProviders";import PaywallOverlay from "@/components/PaywallOverlay";
ReactDOM.createRoot(document.getElementById("root")!).render( <AppProviders> <StatsPage /> <PaywallOverlay /> </AppProviders>,);AppProviders gives the page theme, toasts, and an error boundary.
PaywallOverlay makes every wall render on this page too; it reads the
wall the background publishes to storage, so the decision is the same on
every surface (Paywall reference).
- Read state through the hooks in
apps/extension/hooks/(useAuth,useBilling) and call the backend through background messages. Pages never talk to Firebase directly and never hold an ID token. - Open it from anywhere in the extension:
void browser.tabs.create({ url: browser.runtime.getURL("/stats.html") });A new-tab override (entrypoints/newtab/) is added the same way. Ship
one only when it is the product: it replaces a page the user sees many
times a day, and reviewers look at it closely.