Skip to main content

OrganizationProfileView

The OrganizationProfileView renders the Active Organization's management interface, including members, domains, and other Organization settings.

The OrganizationProfileView renders the management interface. It includes permission-gated Organization profile editing, member management, invitations, Membership Requests, Verified Domains, and flows for leaving or deleting the Organization.

OrganizationProfileView renders content only when a session has an Active Organization. Rows and actions are shown according to the current user's Organization membership Permissions and the current environment settings.

Parameters

  • Name
    isDismissible
    Type
    Bool
    Description

    Whether the view can be dismissed by the user. When true, a dismiss button appears in the navigation bar. 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.

Modifiers

Apply the following modifiers to an OrganizationProfileView to add your own rows to its root screen.

  • Name
    organizationProfileDestination(_:)
    Type
    @ViewBuilder (Route) -> some View
    Description

    Builds the view to push when the user selects a custom row. The closure receives the selected row's route.

  • Name
    organizationProfileRows(_:)
    Type
    [OrganizationProfileCustomRow<Route>]
    Description

    Custom rows to show on the root Organization profile screen, alongside Clerk's built-in rows. Rows that share a placement show in array order.

  • Name
    icon
    Type
    OrganizationProfileRowIcon
    Description

    The row's icon. Pass .system(name:) for an SF Symbol, or .asset(name:width:height:) for an image in your app's asset catalog. Clerk renders asset icons as templates, tinted the same color as its built-in row icons, and sizes them 24 × 24 points by default.

  • Name
    placement
    Type
    OrganizationProfileCustomRowPlacement
    Description

    Where to insert the row relative to Clerk's built-in rows:

    • .sectionStart(_:) or .sectionEnd(_:): The start or end of the .profile or .actions section
    • .before(_:) or .after(_:): Before or after a built-in row (.members, .verifiedDomains, .leaveOrganization, or .deleteOrganization)

    Defaults to .sectionEnd(.profile).

    A row placed before or after a built-in row appears only when that built-in row does. .members, .verifiedDomains, and .deleteOrganization depend on the user's Permissions and your instance settings, as listed in Visible rows and Permissions. .leaveOrganization always appears. To always show a row, use .sectionStart(_:) or .sectionEnd(_:).

  • Name
    route
    Type
    Route: Hashable
    Description

    The value passed to organizationProfileDestination(_:), or pushed onto your navigationPath, when the user selects the row.

  • Name
    title
    Type
    LocalizedStringKey | String
    Description

    The row's title.

Visible rows and Permissions

The profile view shows Organization controls based on the active membership's Permissions and instance settings:

  • Update profile appears when the user has canManageProfile.
  • Members appears when the user has canReadMemberships or canManageMemberships.
  • Verified domains appears when Organization domains are enabled and the user has canReadDomains or canManageDomains.
  • Leave organization appears when there is an membership.
  • Delete organization appears when organization.adminDeleteEnabled is true and the user has canDeleteOrganization.

Usage

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

Fullscreen Organization profile

import ClerkKitUI
import SwiftUI

struct OrganizationSettingsScreen: View {
  var body: some View {
    OrganizationProfileView(isDismissible: false)
  }
}
import ClerkKitUI
import SwiftUI

struct OrganizationSettingsButton: View {
  @State private var profileIsPresented = false

  var body: some View {
    Button("Organization settings") {
      profileIsPresented = true
    }
    .sheet(isPresented: $profileIsPresented) {
      OrganizationProfileView()
    }
  }
}
import ClerkKitUI
import SwiftUI

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

  var body: some View {
    NavigationStack(path: $path) {
      OrganizationProfileView(
        isDismissible: false,
        navigationPath: $path
      )
    }
  }
}

The following example adds a Settings row after the built-in Members row and a Support row at the end of the actions section. When the user selects a row, the view pushes what organizationProfileDestination(_:) returns for its route.

import ClerkKitUI
import SwiftUI

enum OrganizationRoute: Hashable {
  case settings
  case support
}

struct OrganizationSettingsScreen: View {
  var body: some View {
    OrganizationProfileView()
      .organizationProfileRows([
        .init(
          route: OrganizationRoute.settings,
          title: "Settings",
          icon: .system(name: "gear"),
          placement: .after(.members)
        ),
        .init(
          route: OrganizationRoute.support,
          title: "Support",
          icon: .system(name: "questionmark.circle"),
          placement: .sectionEnd(.actions)
        ),
      ])
      .organizationProfileDestination { (route: OrganizationRoute) in
        switch route {
        case .settings:
          // Replace this placeholder with the custom view for your Settings row.
          OrganizationSettingsContent()
        case .support:
          // Replace this placeholder with the custom view for your Support row.
          Text("Support")
        }
      }
  }
}

A custom destination can navigate programmatically with OrganizationProfileNavigator, which OrganizationProfileView adds to the environment when it manages its own NavigationStack. Call push(_:) to push another route, or popToRoot() to return to the root Organization profile screen.

struct OrganizationSettingsContent: View {
  @Environment(OrganizationProfileNavigator<OrganizationRoute>.self) private var navigator

  var body: some View {
    Button("Done") {
      navigator.popToRoot()
    }
  }
}

The navigator's route type must match your custom rows, such as OrganizationProfileNavigator<OrganizationRoute>, or reading it crashes. If you pass a navigationPath, OrganizationProfileView doesn't use organizationProfileDestination(_:). Register .navigationDestination(for:) on your own NavigationStack and push routes onto your path instead. Those destinations have no navigator, so don't read one in them.

Feedback

What did you think of this content?

Last updated on