Skip to main content
Defines a resource that can be nested within modules or other resources. Resources represent individual pages or features in your application.

Signature

Parameters

string
required
URL path for the resource. Supports dynamic segments using colon prefix (e.g., :id, :productSlug).
(props: ResourceComponentProps) => ReactNode
required
Component to render when this resource is active.Receives ResourceComponentProps:
  • title: string - Title of the resource
  • icon?: ReactNode - Optional icon
  • resources?: Resource[] - Optional sub-resources
object
Metadata configuration for the resource.
string | LocalizedString
Display title used in navigation and breadcrumbs. Defaults to path in capital case.
ReactNode
Icon displayed in navigation.
string | ((segment: string) => string)
Custom breadcrumb segment title. Can be a static string or a function that takes the path segment and returns a title.
Resource[]
Nested resources under this resource. Define using defineResource().
Guard[]
Array of guard functions to control access. Guards are executed in order. If any guard returns non-pass result, access is denied.See Route Guards for details.
ReactNode
Error boundary component for this resource and its sub-resources. Overrides module-level or global error boundaries.Use the useRouteError hook to access error details within the component.

Return Type

Resource
A resource object that can be used in a module’s resources array or another resource’s subResources array.

Examples

Basic Resource

Resource with Metadata

Resource with Dynamic Segments

Nested Resources (Sub-resources)

Resource with Guards

Resource with Error Boundary

Resource with Internationalization

Usage in Modules

Notes

  • The component prop is required for resources (unlike modules where it’s optional)
  • Sub-resources do not appear in the sidebar navigation but are accessible via routing and appear in breadcrumbs
  • Dynamic path segments (:paramName) are accessible in the component using useParams() from react-router
  • Resources inherit the module’s error boundary unless they define their own
  • Guards are executed before the component renders during the loader phase