| title | description |
|---|---|
`<OrganizationList />` component |
Clerk's <OrganizationList /> component is used to display organization related memberships, invitations, and suggestions for the user. |
{{ style: { maxWidth: '460px' } }}
The <OrganizationList /> component displays organization-related memberships and automatic invitations and suggestions for the user.
The <OrganizationList /> component accepts the following properties, all of which are optional:
((org: [Organization][org-ref]) => string) | string
The full URL or path to navigate to after creating a new organization.
afterSelectOrganizationUrl((org: Organization) => string) | string
The full URL or path to navigate to after selecting an organization. Defaults to undefined.
afterSelectPersonalUrl((org: Organization) => string) | string
The full URL or path to navigate to after selecting the personal account. Defaults to undefined.
appearanceAppearance | undefined
Optional object to style your components. Will only affect Clerk components and not Account Portal pages.
fallback?ReactNode
An optional element to be rendered while the component is mounting.
hidePersonalboolean
A boolean that controls whether <OrganizationList /> will include the user's personal account in the organization list. Setting this to true will hide the personal account option, and users will only be able to switch between organizations. Defaults to false.
hideSlugboolean
A boolean that controls whether the optional slug field in the organization creation screen is hidden. Defaults to false.
skipInvitationScreenboolean | undefined
A boolean that controls whether the screen for sending invitations after an organization is created is hidden. When undefined, Clerk will automatically hide the screen if the number of max allowed members is equal to 1. Defaults to false.
<Tabs items={["Next.js", "React", "Astro", "Remix", "Tanstack Start", "Vue"]}> ```jsx {{ filename: 'app/organizations/page.tsx' }} import { OrganizationList } from '@clerk/nextjs'
export default function OrganizationListPage() {
return (
<OrganizationList
afterCreateOrganizationUrl="/organization/:slug"
afterSelectPersonalUrl="/user/:id"
afterSelectOrganizationUrl="/organization/:slug"
/>
)
}
```
export default function OrganizationListPage() {
return (
<OrganizationList
afterCreateOrganizationUrl={(org) => `/organization/${org.slug}`}
afterSelectPersonalUrl={(user) => `/user/${user.id}`}
afterSelectOrganizationUrl={(org) => `/organization/${org.slug}`}
/>
)
}
```
<OrganizationList
afterCreateOrganizationUrl="/organization/:slug"
afterSelectPersonalUrl="/user/:id"
afterSelectOrganizationUrl="/organization/:slug"
/>
```
export default function OrganizationListPage() {
return (
<OrganizationList
afterCreateOrganizationUrl={(org) => `/organization/${org.slug}`}
afterSelectPersonalUrl={(user) => `/user/${user.id}`}
afterSelectOrganizationUrl={(org) => `/organization/${org.slug}`}
/>
)
}
```
export const Route = createFileRoute('/organizations')({
component: OrganizationList,
})
function OrganizationList() {
return (
<OrganizationList
afterCreateOrganizationUrl={(org) => `/organization/${org.slug}`}
afterSelectPersonalUrl={(user) => `/user/${user.id}`}
afterSelectOrganizationUrl={(org) => `/organization/${org.slug}`}
/>
)
}
```
<template>
<OrganizationList
:after-create-organization-url="(org) => `/organization/${org.slug}`"
:after-select-personal-url="(org) => `/organization/${org.slug}`"
:after-select-organization-url="(org) => `/organization/${org.slug}`"
/>
</template>
```
The following methods available on an instance of the Clerk class are used to render and control the <OrganizationList /> component:
The following examples assume that you have followed the quickstart in order to add Clerk to your JavaScript application.
Render the <OrganizationList /> component to an HTML <div> element.
function mountOrganizationList(node: HTMLDivElement, props?: OrganizationListProps): voidThe `<div>` element used to render in the `<OrganizationList />` component
---
- `props?`
- [`OrganizationListProps`](#properties)
The properties to pass to the `<OrganizationList />` component
import { Clerk } from '@clerk/clerk-js'
// Initialize Clerk with your Clerk Publishable Key
const clerkPubKey = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY
const clerk = new Clerk(clerkPubKey)
await clerk.load()
document.getElementById('app').innerHTML = `
<div id="organization-list"></div>
`
const orgListDiv = document.getElementById('organization-list')
clerk.mountOrganizationList(orgListDiv)Unmount and run cleanup on an existing <OrganizationList /> component instance.
function unmountOrganizationList(node: HTMLDivElement): voidThe container `<div>` element with a rendered `<OrganizationList />` component instance
import { Clerk } from '@clerk/clerk-js'
// Initialize Clerk with your Clerk Publishable Key
const clerkPubKey = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY
const clerk = new Clerk(clerkPubKey)
await clerk.load()
document.getElementById('app').innerHTML = `
<div id="organization-list"></div>
`
const orgListDiv = document.getElementById('organization-list')
clerk.mountOrganizationList(orgListDiv)
// ...
clerk.unmountOrganizationList(orgListDiv)If you would like to prohibit people from using their personal accounts and force them to be part of an organization, the hidePersonal property forces your user to join or create an organization in order to continue. For more information on how to hide personal accounts and force organizations, see the dedicated guide.
export default function OrganizationListPage() {
return (
<OrganizationList
hidePersonal={true}
// ...
/>
)
}To learn about how to customize Clerk components, see the customization documentation.