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 <shahednasser@gmail.com>

* docs: add new line

---------

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>
This commit is contained in:
Eugene Pro
2025-01-20 15:21:09 +02:00
committed by GitHub
parent 402a5c3cd4
commit b278ee5ff1

View File

@@ -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 (
<Container className="divide-y p-0">
<div className="flex items-center justify-between px-6 py-4">
<Heading level="h1">Nested Orders Page</Heading>
</div>
</Container>
)
}
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