# <ClerkLoaded>

The `<ClerkLoaded>` component guarantees that the Clerk object has loaded (the `status` is `'ready'` or `'degraded'`) and will be available under `window.Clerk`. This allows you to wrap child components to access the `Clerk` object without the need to check it exists.

## Usage with JavaScript

The following methods available on an instance of the [Clerk](https://clerk.com/docs/js-frontend/reference/objects/clerk.md) class is used to render and control the `<ClerkLoaded />` component:

- [load()](https://clerk.com/docs/js-frontend/reference/components/control/clerk-loaded.md#load)

The following examples assume that you have followed the [quickstart](https://clerk.com/docs/js-frontend/getting-started/quickstart.md) in order to add Clerk to your JavaScript application.

### `load()`

Render the `<ClerkLoaded>` component to an HTML `<div>` element.

```typescript
function load(options?: ClerkOptions): Promise<void>
```

#### `ClerkOptions`

The `load()` method accepts an optional object that accepts the following props. All props are optional.

| Name                                                                                | Type                                                                                                                                                                                                                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <a id="aftermultisessionsinglesignouturl"></a> `afterMultiSessionSingleSignOutUrl?` | `string | null`                                                                                                                                                                                                         | The full URL or path to navigate to after signing out the current user is complete. This option applies to [multi-session applications](https://clerk.com/docs/guides/secure/session-options.md?sdk=js-frontend#multi-session-applications).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| <a id="aftersignouturl"></a> `afterSignOutUrl?`                                     | `string | null`                                                                                                                                                                                                         | The full URL or path to navigate to after successful sign out.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `allowedRedirectOrigins?`                                                           | `(string | RegExp)[]`                                                                                                                                                                                                   | An array of domains to validate user-provided redirect URLs against. If no match is made, the redirect is considered unsafe and the default redirect will be used with a warning logged in the console.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `allowedRedirectProtocols?`                                                         | `string[]`                                                                                                                                                                                                              | An array of protocols to validate user-provided redirect URLs against. If no match is made, the redirect is considered unsafe and the default redirect will be used with a warning logged in the console.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `appearance?`                                                                       | `any`                                                                                                                                                                                                                              | An object to style your components. Will only affect [Clerk Components](https://clerk.com/docs/js-frontend/reference/components/overview.md) and not [Account Portal](https://clerk.com/docs/guides/account-portal/overview.md?sdk=js-frontend) pages. See the [Appearance](https://clerk.com/docs/js-frontend/guides/customizing-clerk/appearance-prop/overview.md) docs for more information.                                                                                                                                                                                                                                                                                                                                |
| `experimental?`                                                                     | `Autocomplete`<`{ commerce: boolean; persistClient: boolean; rethrowOfflineNetworkErrors: boolean; runtimeEnvironment: "headless"; }`, `Record`<`string`, `any`>>                                                     | Enable experimental flags to gain access to new features. These flags are not guaranteed to be stable and may change drastically in between patch or minor versions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `isSatellite?`                                                                      | `boolean | (url: URL) => boolean`                                                                                                                                                                                       | Indicates whether the application is a satellite application.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `localization?`                                                                     | [`LocalizationResource`](https://clerk.com/docs/guides/customizing-clerk/localization.md?sdk=js-frontend)                                                                                                                          | An object to localize your components. Will only affect [Clerk Components](https://clerk.com/docs/js-frontend/reference/components/overview.md) and not [Account Portal](https://clerk.com/docs/guides/account-portal/overview.md?sdk=js-frontend) pages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <a id="newsubscriptionredirecturl"></a> `newSubscriptionRedirectUrl?`               | `string | null`                                                                                                                                                                                                         | The full URL or path to navigate to after the user completes the checkout and clicks the "Continue" button.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `polling?`                                                                          | `boolean`                                                                                                                                                                                                                          | Indicates whether Clerk should poll against Clerk's backend every 5 minutes. Defaults to `true`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `routerDebug?`                                                                      | `boolean`                                                                                                                                                                                                                          | If `true`, the router will log debug information to the console.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `routerPush()`                                                                      | `(to: string, metadata?: { windowNavigate: (to: URL | string) => void; }) => unknown`                                                                                                                                   | A function which takes the destination path as an argument and performs a "push" navigation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `routerReplace()`                                                                   | `(to: string, metadata?: { windowNavigate: (to: URL | string) => void; }) => unknown`                                                                                                                                   | A function which takes the destination path as an argument and performs a "replace" navigation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `satelliteAutoSync?`                                                                | `boolean`                                                                                                                                                                                                                          | Controls whether satellite apps automatically sync with the primary domain on initial page load. When `false` (default), satellite apps will skip the automatic handshake if no session cookies exist, and only trigger the handshake after an explicit sign-in action. This provides the best performance by showing the satellite app immediately without attempting to sync state first. When `true`, satellite apps will automatically trigger a handshake redirect to sync authentication state with the primary domain on first load, even if no session cookies exist. Use this if you want users who are already signed in on the primary domain to be automatically recognized on the satellite. Defaults to `false`. |
| `sdkMetadata?`                                                                      | `{ environment?: string; name: string; version: string; }`                                                                                                                                                              | Contains information about the SDK that the host application is using. You don't need to set this value yourself unless you're [developing an SDK](https://clerk.com/docs/guides/development/sdk-development/overview.md?sdk=js-frontend).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `sdkMetadata.environment?`                                                          | `string`                                                                                                                                                                                                                           | Typically this will be the `NODE_ENV` that the SDK is currently running in.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `sdkMetadata.name`                                                                  | `string`                                                                                                                                                                                                                           | The npm package name of the SDK.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `sdkMetadata.version`                                                               | `string`                                                                                                                                                                                                                           | The npm package version of the SDK.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `selectInitialSession()?`                                                           | <code>(client: <a href="https://clerk.com/docs/js-frontend/reference/objects/client.md">ClientResource</a>) => <a href="https://clerk.com/docs/js-frontend/reference/objects/session.md">SignedInSessionResource</a> | null</code> | By default, the last signed-in session is used during client initialization. This option allows you to override that behavior, e.g. by selecting a specific session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| <a id="signinfallbackredirecturl"></a> `signInFallbackRedirectUrl?`                 | `string | null`                                                                                                                                                                                                         | The fallback URL to redirect to after the user signs in, if there's no `redirect_url` in the path already. It's recommended to use the [environment variable](https://clerk.com/docs/guides/development/clerk-environment-variables.md?sdk=js-frontend#sign-in-and-sign-up-redirects) instead. Defaults to `'/'`.                                                                                                                                                                                                                                                                                                                                                                                                              |
| <a id="signinforceredirecturl"></a> `signInForceRedirectUrl?`                       | `string | null`                                                                                                                                                                                                         | If provided, this URL will always be redirected to after the user signs in. It's recommended to use the [environment variable](https://clerk.com/docs/guides/development/clerk-environment-variables.md?sdk=js-frontend#sign-in-and-sign-up-redirects) instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `signInUrl?`                                                                        | `string`                                                                                                                                                                                                                           | This URL will be used for any redirects that might happen and needs to point to your primary application on the client-side. This option is optional for production instances. **It is required to be set for a satellite application in a development instance**. It's recommended to use [the environment variable](https://clerk.com/docs/guides/development/clerk-environment-variables.md?sdk=js-frontend#sign-in-and-sign-up-redirects) instead.                                                                                                                                                                                                                                                                         |
| <a id="signupfallbackredirecturl"></a> `signUpFallbackRedirectUrl?`                 | `string | null`                                                                                                                                                                                                         | The fallback URL to redirect to after the user signs up, if there's no `redirect_url` in the path already. It's recommended to use the [environment variable](https://clerk.com/docs/guides/development/clerk-environment-variables.md?sdk=js-frontend#sign-in-and-sign-up-redirects) instead. Defaults to `'/'`.                                                                                                                                                                                                                                                                                                                                                                                                              |
| <a id="signupforceredirecturl"></a> `signUpForceRedirectUrl?`                       | `string | null`                                                                                                                                                                                                         | If provided, this URL will always be redirected to after the user signs up. It's recommended to use the [environment variable](https://clerk.com/docs/guides/development/clerk-environment-variables.md?sdk=js-frontend#sign-in-and-sign-up-redirects) instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `signUpUrl?`                                                                        | `string`                                                                                                                                                                                                                           | This URL will be used for any redirects that might happen and needs to point to your primary application on the client-side. This option is optional for production instances. **It is required to be set for a satellite application in a development instance**. It's recommended to use [the environment variable](https://clerk.com/docs/guides/development/clerk-environment-variables.md?sdk=js-frontend#sign-in-and-sign-up-redirects) instead.                                                                                                                                                                                                                                                                         |
| `standardBrowser?`                                                                  | `boolean`                                                                                                                                                                                                                          | Indicates whether ClerkJS is loaded with the assumption that cookies can be set (browser setup). On native platforms this value must be set to `false`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `supportEmail?`                                                                     | `string`                                                                                                                                                                                                                           | The support email address for display in authentication screens. Will only affect [Clerk Components](https://clerk.com/docs/js-frontend/reference/components/overview.md) and not [Account Portal](https://clerk.com/docs/guides/account-portal/overview.md?sdk=js-frontend) pages.                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `taskUrls?`                                                                         | `Partial`<`Record`<[SessionTask](https://clerk.com/docs/js-frontend/reference/types/session-task.md)[`"key"`], `string`>>                                                                                                       | Customize the URL paths users are redirected to after sign-in or sign-up when specific session tasks need to be completed. When `undefined`, it uses Clerk's default task flow URLs. Defaults to `undefined`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `telemetry?`                                                                        | `false | { debug?: boolean; disabled?: boolean; perEventSampling?: boolean; }`                                                                                                                                          | Controls whether or not Clerk will collect [telemetry data](https://clerk.com/docs/guides/how-clerk-works/security/clerk-telemetry.md?sdk=js-frontend). If set to `debug`, telemetry events are only logged to the console and not sent to Clerk.                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `telemetry.debug?`                                                                  | `boolean`                                                                                                                                                                                                                          | If `true`, telemetry events are only logged to the console and not sent to Clerk                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `telemetry.disabled?`                                                               | `boolean`                                                                                                                                                                                                                          | If `true`, telemetry will not be collected.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `telemetry.perEventSampling?`                                                       | `boolean`                                                                                                                                                                                                                          | If false, the sampling rates provided per telemetry event will be ignored and all events will be sent. Defaults to `true`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `touchSession?`                                                                     | `boolean`                                                                                                                                                                                                                          | By default, the [Clerk Frontend API `touch` endpoint](https://clerk.com/docs/reference/frontend-api/tag/Sessions#operation/touchSession){{ target: '_blank' }} is called during page focus to keep the last active session alive. This option allows you to disable this behavior.                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `ui?`                                                                               | <code>{ ClerkUI?: ClerkUIConstructor | Promise<ClerkUIConstructor>; }</code>                                                                                                                                                       | **Only required if you're bundling Clerk's UI (`@clerk/ui`) instead of loading it from the Clerk CDN**. Provide the UI module to embed Clerk's prebuilt authentication components directly in your application.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `ui.ClerkUI?`                                                                       | <code>ClerkUIConstructor | Promise<ClerkUIConstructor></code>                                                                                                                                                                      | Pass the `ui` export from `@clerk/ui`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `waitlistUrl?`                                                                      | `string`                                                                                                                                                                                                                           | The full URL or path to the waitlist page. If `undefined`, will redirect to the [Account Portal waitlist page](https://clerk.com/docs/guides/account-portal/overview.md?sdk=js-frontend#waitlist).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

#### `load()` usage

filename: main.js
```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()
```

---

## Sitemap

[Overview of all docs pages](https://clerk.com/docs/llms.txt)
