Skip to main content
Docs

<OrganizationList /> component

Theme

The <OrganizationList /> component displays Organization-related memberships and automatic invitations and suggestions for the user.

Usage with JavaScript

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 quickstartJavaScript Icon in order to add Clerk to your JavaScript application.

mountOrganizationList()

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

function mountOrganizationList(node: HTMLDivElement, props?: OrganizationListProps): void
  • Name
    node
    Type
    HTMLDivElement
    Description

    The <div> element used to render in the <OrganizationList /> component

  • Name
    props?
    Type
    OrganizationListProps
    Description

    The properties to pass to the <OrganizationList /> component

main.js
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)

unmountOrganizationList()

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

function unmountOrganizationList(node: HTMLDivElement): void
  • Name
    node
    Type
    HTMLDivElement
    Description

    The container <div> element with a rendered <OrganizationList /> component instance

main.js
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)

Properties

The <OrganizationList /> component accepts the following properties, all of which are optional:

  • Name
    afterCreateOrganizationUrl?
    Type
    ((org: Organization) => string) | string
    Description

    The full URL or path to navigate to after creating a new Organization.

  • Name
    afterSelectOrganizationUrl?
    Type
    ((org: Organization) => string) | string
    Description

    The full URL or path to navigate to after selecting an Organization. Defaults to undefined.

  • Name
    afterSelectPersonalUrl?
    Type
    ((org: Organization) => string) | string
    Description

    The full URL or path to navigate to after selecting the . Defaults to undefined.

  • Name
    appearance?
    Type
    Appearance | undefined
    Description

    An object to style your components. Will only affect Clerk components and not Account Portal pages.

  • Name
    fallback?
    Type
    ReactNode
    Description

    An element to be rendered while the component is mounting.

  • Name
    hidePersonal?
    Type
    boolean
    Description

    A boolean that controls whether <OrganizationList /> will include the user's 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.

  • Name
    skipInvitationScreen?
    Type
    boolean | undefined
    Description

    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.

Customization

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

Feedback

What did you think of this content?

Last updated on