Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerkstage.dev

JavaScript <OrganizationProfile />

This JavaScript reference describes the properties and methods related to Clerk's <OrganizationProfile /> component. If you are looking for the React component, see the <OrganizationProfile /> documentation.

Organization Profile Example

The <OrganizationProfile /> component is used to render a beautiful, full-featured organization management UI that allows users to manage their organization profile and security settings.

The following methods available on an instance of the Clerk class are used to render and control the <OrganizationProfile /> component:

mountOrganizationProfile()

Render the <OrganizationProfile /> component to an HTML <div> element.

function mountOrganizationProfile(node: HTMLDivElement, props?: OrganizationProfileProps): void;

mountOrganizationProfile() params

NameTypeDescription
nodeHTMLDivElement(opens in a new tab)The <div> element used to render in the <OrganizationProfile /> component
props?OrganizationProfilePropsThe properties to pass to the <OrganizationProfile /> component

mountOrganizationProfile() usage

main.js
import Clerk from '@clerk/clerk-js'; // Initialize Clerk with your Clerk publishable key const clerk = new Clerk('{{pub_key}}'); await clerk.load(); document.getElementById("app").innerHTML = ` <div id="organization-profile"></div> `; const orgProfileDiv = document.getElementById("organization-profile"); clerk.mountOrganizationProfile(orgProfileDiv);
index.html
<!-- Add a <div id="organization-profile"> element to your HTML --> <div id="organization-profile"></div> <script> window.addEventListener("load", async function () { await Clerk.load(); const orgProfileDiv = document.getElementById('organization-profile'); Clerk.mountOrganizationProfile(orgProfileDiv); }); </script>

unmountOrganizationProfile()

Unmount and run cleanup on an existing <OrganizationProfile /> component instance.

function unmountOrganizationProfile(node: HTMLDivElement): void;

unmountOrganizationProfile() params

NameTypeDescription
nodeHTMLDivElement(opens in a new tab)The container <div> element with a rendered <OrganizationProfile /> component instance.

unmountOrganizationProfile() usage

main.js
import Clerk from '@clerk/clerk-js'; // Initialize Clerk with your Clerk publishable key const clerk = new Clerk('{{pub_key}}'); await clerk.load(); document.getElementById('app').innerHTML = ` <div id="organization-profile"></div> ` const orgProfileDiv = document.getElementById('organization-profile'); clerk.mountOrganizationProfile(orgProfileDiv); // ... clerk.unmountOrganizationProfile(orgProfileDiv);
index.html
<!-- Add a <div id="organization-profile"> element to your HTML --> <div id="organization-profile"></div> <script> window.addEventListener("load", async function () { await Clerk.load(); const orgProfileDiv = document.getElementById('organization-profile'); Clerk.mountOrganizationProfile(orgProfileDiv); // ... Clerk.unmountOrganizationProfile(orgProfileDiv); }); </script>

openOrganizationProfile()

Opens the <OrganizationProfile /> component as an overlay at the root of your HTML body element.

function openOrganizationProfile(props?: OrganizationProfileProps): void;

openOrganizationProfile() params

NameTypeDescription
props?OrganizationProfilePropsThe properties to pass to the <OrganizationProfile /> component

openOrganizationProfile() usage

main.js
import Clerk from '@clerk/clerk-js'; // Initialize Clerk with your Clerk publishable key const clerk = new Clerk('{{pub_key}}'); await clerk.load(); document.getElementById('app').innerHTML = ` <div id="organization-profile"></div> ` const orgProfileDiv = document.getElementById('organization-profile'); clerk.openOrganizationProfile(orgProfileDiv);
index.html
<!-- Add a <div id="organization-profile"> element to your HTML --> <div id="organization-profile"></div> <script> window.addEventListener("load", async function () { await Clerk.load(); const orgProfileDiv = document.getElementById('organization-profile'); Clerk.openOrganizationProfile(orgProfileDiv); }); </script>

closeOrganizationProfile()

Closes the organization profile overlay.

function closeOrganizationProfile(): void;

closeOrganizationProfile() usage

main.js
import Clerk from '@clerk/clerk-js'; // Initialize Clerk with your Clerk publishable key const clerk = new Clerk('{{pub_key}}'); await clerk.load(); document.getElementById('app').innerHTML = ` <div id="organization-profile"></div> ` const orgProfileDiv = document.getElementById('organization-profile'); clerk.closeOrganizationProfile(orgProfileDiv);
index.html
<!-- Add a <div id="organization-profile"> element to your HTML --> <div id="organization-profile"></div> <script> window.addEventListener("load", async function () { await Clerk.load(); const orgProfileDiv = document.getElementById('organization-profile'); Clerk.closeOrganizationProfile(orgProfileDiv); }); </script>

OrganizationProfileProps

All props below are optional.

NameTypeDescription
afterLeaveOrganizationUrlstringFull URL or path to navigate after leaving an organization.
routing'hash' | 'path' | 'virtual'The routing strategy for your pages.
pathstringThe path where the component is mounted when path-based routing is used.
For example: /organization-profile.
This prop is ignored in hash-based routing.
appearanceAppearanceOptional object to style your components. Will only affect Clerk Components and not Account Portal pages.
customPagesCustomPage[]An array of custom pages to add to the organization profile.

How to customize the <OrganizationProfile /> component

To learn about how to customize Clerk components, see the customization documentation.

In addition, you also can add custom pages and links to the navigation sidebar of the <OrganizationProfile /> component. See the example below:

main.js
import Clerk from '@clerk/clerk-js'; const clerk = new Clerk('{{pub_key}}'); await clerk.load(); clerk.openOrganizationProfile({ customPages: [ { url: "custom-page", label: "Custom Page", mountIcon: (el) => { el.innerHTML = "πŸ‘‹"; }, unmountIcon: (el) => { el.innerHTML = ""; }, mount: (el) => { el.innerHTML = ` <h1><b>Custom Page</b></h1> <p>This is the content of the custom page.</p> `; }, unmount: (el) => { el.innerHTML = ""; }, }, { url: "/other-page", label: "Other Page", mountIcon: (el) => { el.innerHTML = "🌐"; }, unmountIcon: (el) => { el.innerHTML = ""; }, } ] });
index.html
<script> window.addEventListener('load', async function () { await Clerk.load(); Clerk.openOrganizationProfile({ customPages: [ { url: "custom-page", label: "Custom Page", mountIcon: (el) => { el.innerHTML = "πŸ‘‹"; }, unmountIcon: (el) => { el.innerHTML = ""; }, mount: (el) => { el.innerHTML = ` <h1><b>Custom Page</b></h1> <p>This is the content of the custom page.</p> `; }, unmount: (el) => { el.innerHTML = ""; }, }, { url: "/other-page", label: "Other Page", mountIcon: (el) => { el.innerHTML = "🌐"; }, unmountIcon: (el) => { el.innerHTML = ""; }, } ] }); }); </script>

What did you think of this content?

Clerk Β© 2024