Create your own page
Create a page by adding its page.tsx file. Register the route so the app can identify the page and apply its settings, then add a navigation link if it should appear in the menu.
The snippets below use Reports as an example. Substitute your own page name, URL and key when following the steps. Start with your project running locally.
- 1
Create the page
Create a folder for your page under
src/app/(protected-pages)/and add apage.tsxfile inside it. For example:src/app/(protected-pages)/reports/page.tsxThe page folder determines the URL:
reports/page.tsxcreates/reports. Pages inside(protected-pages)use the app's existing layout and navigation; the group name in parentheses is not part of the URL.With your development server running, open your page's URL, such as
http://localhost:3000/reports. Its content should appear inside the app's layout. It will not have a menu link until you add one. - 2
Register the page with the app
In
src/configs/routes.config.ts, add this entry inside the existingprotectedRoutesobject:src/configs/routes.config.tsReplace
/reportswith your page's URL and choose a uniquekey. The key identifies the page within the app; use the same value if you add a navigation item for it.Keep the existing route entries and
// nateui:...comments. Add the new entry alongside them.Leave
authority: []as shown for this example. The starter's route configuration and(protected-pages)group do not enforce sign-in; see Auth when adding access control. - 3
Add a navigation link (optional)
Add a link if you want the page to appear in the app's navigation. A page without a menu item is still available at its URL.
Choose an icon for the link. You can use an existing entry in
src/configs/navigation-icon.config.tsx, or add one. For this example, add this import alongside the existing imports:src/configs/navigation-icon.config.tsxThen add an entry inside the existing
navigationIconobject:src/configs/navigation-icon.config.tsxKeep the other icon entries and
// nateui:...comments.In
src/configs/navigation.config.ts, add this item inside the existingnavigationConfigarray:src/configs/navigation.config.tsUse the same
keyas the route entry so the app can mark the menu item as active. Setpathto your page's URL,titleto its display name, andiconto the icon-map entry you chose.Keep the existing menu items and insertion comments. Place the new item where you want the page to appear in the menu.
Open the page from the navigation. Its content should appear, and its menu item should be marked as active.
Continue building your screen in page.tsx, reusing components from src/components/. When the page needs records, follow Connect your data. For page padding, width or footer changes, see Layouts.