Add custom pages and links to the <OrganizationProfile /> component
The <OrganizationProfile /> component supports the addition of custom pages and use of external links in the navigation sidebar.
There are two ways to render the <OrganizationProfile /> component:
As a modal
As a dedicated page
Both can be accessed when the user selects the <OrganizationSwitcher />, and then selects the Manage Organization option.
This guide includes examples for both use cases. You can select one of the following two tabs on the code examples to see the implementation for your preferred use case:
<OrganizationSwitcher /> tab: By default, the <OrganizationSwitcher /> sets organizationProfileMode='modal'. If you are using the default settings, then you should select this tab.
Dedicated page tab: If you do not want the <OrganizationProfile /> to open as a modal, then you should select this tab. For these examples, you need to set organizationProfileMode='navigation' and organizationProfileUrl='/organization-profile' on the <OrganizationSwitcher /> component.
For the sake of this guide, examples are written for Next.js App Router, but they are supported by any React meta framework, such as Remix.
Custom pages can be rendered inside the <OrganizationProfile /> component and provide a way to incorporate app-specific settings or additional functionality.
To add a custom page to the <OrganizationProfile /> component, use the <OrganizationSwitcher.OrganizationProfilePage /> component or the <OrganizationProfile.Page /> component, depending on your use case.
<OrganizationSwitcher.OrganizationProfilePage /> and <OrganizationProfile.Page /> accept the following props, all of which are required:
Name
label
Type
string
Description
The name that will be displayed in the navigation sidebar for the custom page.
Name
labelIcon
Type
React.ReactElement
Description
An icon displayed next to the label in the navigation sidebar.
Name
url
Type
string
Description
The path segment that will be used to navigate to the custom page. (e.g. if the <OrganizationProfile /> component is rendered at /organization, then the custom page will be accessed at /organization/{url} when using path routing).
Name
children
Type
React.ReactElement
Description
The components to be rendered as content inside the custom page.
The following example demonstrates two ways that you can render content in the <OrganizationSwitcher.OrganizationProfilePage /> or <OrganizationProfile.Page /> component: as a component or as a direct child.
To add custom pages to the <OrganizationProfile /> component using the JavaScript SDK, you can pass the customPages property to the mountOrganizationProfile() or openOrganizationProfile() method, as shown in the following example:
You can add external links to the <OrganizationProfile /> navigation sidebar using the <OrganizationSwitcher.OrganizationProfileLink /> component or the <OrganizationProfile.Link /> component, depending on your use case.
If you want to reorder the default routes, Members and General, set the label prop to 'members' or 'general'. This will target the existing default page and allow you to rearrange it.
Note that when reordering default routes, the first item in the navigation sidebar cannot be a <OrganizationSwitcher.OrganizationProfileLink /> or <OrganizationProfile.Link /> component.
<OrganizationSwitcher />
Dedicated Page
The first page in the list will always be rendered under the root path defined with the path prop. Its url prop will be ignored.
In the following example, path is set to /organization-profile, so the <CustomPage /> is rendered under the /organization-profile path.
With the above example, the <OrganizationProfile /> navigation sidebar will be in the following order: