From b278ee5ff1ef4ba2d39eea798e24a20e2b2b2305 Mon Sep 17 00:00:00 2001 From: Eugene Pro Date: Mon, 20 Jan 2025 15:21:09 +0200 Subject: [PATCH] docs: how to add new admin route under existing route (#10652) * docs: how to add new admin route under existing route * docs: update about defineRouteConfig * docs: add new line Co-authored-by: Shahed Nasser * docs: add new line --------- Co-authored-by: Shahed Nasser --- .../fundamentals/admin/ui-routes/page.mdx | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/www/apps/book/app/learn/fundamentals/admin/ui-routes/page.mdx b/www/apps/book/app/learn/fundamentals/admin/ui-routes/page.mdx index ae46031f74..9efe3590a1 100644 --- a/www/apps/book/app/learn/fundamentals/admin/ui-routes/page.mdx +++ b/www/apps/book/app/learn/fundamentals/admin/ui-routes/page.mdx @@ -145,6 +145,34 @@ Some caveats for nested UI routes in the sidebar: - Nested routes in setting pages aren't shown in the sidebar to follow the admin's design conventions. - The `icon` configuration is ignored for the sidebar item of nested UI route to follow the admin's design conventions. +### Route Under Existing Admin Route + +You can add a custom UI route under an existing route. For example, you can add a route under the orders route: + +```tsx title="src/admin/routes/orders/nested/page.tsx" +import { defineRouteConfig } from "@medusajs/admin-sdk" +import { Container, Heading } from "@medusajs/ui" + +const NestedOrdersPage = () => { + return ( + +
+ Nested Orders Page +
+
+ ) +} + +export const config = defineRouteConfig({ + label: "Nested Orders", + nested: "/orders", +}) + +export default NestedOrdersPage +``` + +The `nested` property passed to `defineRouteConfig` specifies which route this custom route is nested under. This route will now show in the sidebar under the existing "Orders" sidebar item. + --- ## Create Settings Page