Skip to main content

OrganizationListView

The OrganizationListView renders a standalone account picker for choosing between the user's Personal Account and Organization accounts.

The OrganizationListView renders a standalone account picker for choosing between the user's and Organization accounts. It lists the Personal Account when allowed, Organization memberships, pending Organization invitations, suggested Organizations, and a Create organization action for users who can create Organizations.

Personal Account selection clears the . Organization selection sets the selected Organization as active.

Parameters

  • Name
    hidePersonal
    Type
    Bool
    Description

    Whether the option should be hidden even when the option is allowed. Defaults to false.

  • Name
    isDismissable
    Type
    Bool
    Description

    Whether the view can be dismissed by the user. When true, a dismiss button appears and the view closes automatically after account selection. When false, no dismiss button is shown. Defaults to true.

  • Name
    navigationPath
    Type
    Binding<NavigationPath>?
    Description

    An optional parent navigation path for embedded usage. Pass a parent path when the view is hosted inside your own NavigationStack.

  • Name
    skipInvitationScreen
    Type
    Bool
    Description

    Whether creating an Organization should skip the post-create invitation step. Defaults to false.

Usage

The following examples show how to use the OrganizationListView in your app.

Fullscreen account picker

import ClerkKitUI
import SwiftUI

struct AccountPickerView: View {
  var body: some View {
    OrganizationListView(isDismissable: false)
  }
}
import ClerkKitUI
import SwiftUI

struct AccountPickerButton: View {
  @State private var accountPickerIsPresented = false

  var body: some View {
    Button("Switch account") {
      accountPickerIsPresented = true
    }
    .sheet(isPresented: $accountPickerIsPresented) {
      OrganizationListView()
    }
  }
}
import ClerkKitUI
import SwiftUI

struct AccountPickerScreen: View {
  @State private var path = NavigationPath()

  var body: some View {
    NavigationStack(path: $path) {
      OrganizationListView(
        isDismissable: false,
        navigationPath: $path
      )
    }
  }
}

Note

When using both hidePersonal and isDismissable, place hidePersonal before isDismissable in the OrganizationListView initializer. Otherwise, Swift will raise an argument-order error.

OrganizationListView(hidePersonal: true)

Feedback

What did you think of this content?

Last updated on