React API reference
Every export is fully typed. The signatures and props below come from the package's own reference documentation, so what is listed here is what the installed version ships.
Hooks
useThunderID()
hook
The useChoreo Identity & Access Management hook provides access to the Choreo Identity & Access Management authentication context in React applications. It allows you to retrieve authentication state, user information, and other context values managed by the Choreo Identity & Access ManagementProvider.
Returns
| Name | Type | Description |
|---|---|---|
| isSignedIn | boolean | Whether the user is currently signed in |
| user | User \ | The authenticated user object, or null if not signed in |
| signIn | () => Promise | Initiates the sign-in flow |
| signOut | () => Promise | Initiates the sign-out flow |
| loading | boolean | Indicates if an authentication operation is in progress |
| error | Error \ | The last error encountered during authentication, if any |
import { useThunderID } from '@thunderid/react'
function MyComponent() {
const { isSignedIn, user, signIn, signOut } = useThunderID()
return (
<div>
{isSignedIn ? (
<>
<p>Welcome, {user?.displayName}!</p>
<button onClick={() => signOut()}>Sign Out</button>
</>
) : (
<button onClick={() => signIn()}>Sign In</button>
)}
</div>
)
}
export default MyComponent
Contexts
ThunderIDProvider /
context
The ThunderIDProvider is the root context provider component that configures @thunderid/react and provides Choreo Identity & Access Management context to your entire React application. It must wrap your application to enable authentication features.
Props
| Name | Type | Description |
|---|---|---|
| clientId (required) | string | Client ID of your application |
| baseUrl (required) | string | The base URL of the Choreo Identity & Access Management instance (e.g., https://<DATA_PLANE_URL>) |
| clientSecret (optional) | string | Client secret of your application. Only required for confidential clients. |
| scopes | string \ | OpenID Connect Scopes to request during the sign-in. Defaults to 'openid profile internal_login' if not provided. |
| storage | sessionStorage or localStorage \ | Storage mechanism to use for session management. Defaults to sessionStorage if not provided. |
| session (optional) | SessionConfig | Behaviour around the Choreo Identity & Access Management session. Set session.silentSignIn.beforeRedirect to true to try a silent sign-in before signIn() redirects. The silent attempt is skipped when the sign-in options set their own prompt. session.silentSignIn.timeout (milliseconds, default 10000) bounds how long a silent sign-in waits. |
| afterSignInUrl (optional) | string | URL to redirect to after sign-in process is completed. |
| afterSignUpUrl (optional) | string | URL to redirect to after sign-up process is completed. |
| afterSignOutUrl (optional) | string | URL to redirect to after sign-out process is completed. |
| tokenValidation (optional) | TokenValidation | Configuration for token validation. |
| preferences (optional) | Preferences | Customization options for UI behavior, internationalization (i18n) and styling. |
| idToken | IdTokenValidation | Configuration for ID token validation |
| validateIssuer | boolean | Whether to validate the issuer |
| clockTolerance | number | Allowed clock skew in seconds |
| inheritFromBranding | boolean | Whether to inherit theme from Choreo Identity & Access Management organization/application branding |
| mode | light \ | Theme mode. 'system' follows user's OS preference |
| overrides | ThemeConfig | Custom theme overrides for colors, typography, spacing, etc. |
| language | string | Language code for UI text (e.g., 'en-US', 'es-ES') |
| fallbackLanguage | string | Fallback language when translations aren't available |
| bundles | object | Custom translation bundles to override default text |
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from "./App.jsx"
import { ThunderIDProvider } from '@thunderid/react'
createRoot(document.getElementById('root')).render(
<StrictMode>
<ThunderIDProvider
clientId="<your-app-client-id>"
baseUrl="https://<DATA_PLANE_URL>"
>
<App />
</ThunderIDProvider>
</StrictMode>
)
Components
ChangeCredential /
component
The ChangeCredential component renders a form that lets a signed-in user set a new value for one of their own credentials. It collects only a new value and its confirmation, checks it against the applicable rules as the user types, and posts the change to Choreo Identity & Access Management. It reads the rules it needs from the user type schema already resolved by ThunderIDProvider (GET /users/me/meta), so it adds no network request beyond the write itself. Every default label, placeholder, and message is built from the credential attribute's own displayName in that schema, so it always matches whatever an admin named it there. By default it manages the password credential. To manage a different one, for example a PIN declared on the user type schema, set attribute; render the component once per credential to let a user manage more than one.
ChangeCredential collects only a new value and its confirmation, not the account's existing value. The self-service credential write path does not verify the current value today, so asking for one would only teach the user a false sense of security. Once server-side current-value verification ships, that field returns without a breaking change to this component's public props.
Props
| Name | Type | Description |
|---|---|---|
| attribute (optional) | string | The credential attribute this instance manages, any attribute the user type schema declares credential: true for. Defaults to 'password'. |
| cardLayout (optional) | boolean | Whether to wrap the form in a bordered card. Defaults to false. |
| className (optional) | string | Additional CSS class names. |
| onSuccess (optional) | () => void | Called after the credential has been changed successfully. |
| policy (optional) | PasswordPolicy | The rules the new value must satisfy. Defaults to the applicable rules from the user type schema. |
| preferences (optional) | Preferences | Component-level preference overrides, including i18n. |
| showRequirements (optional) | boolean | Whether to render the live requirement checklist. Defaults to true. |
| title (optional) | string | Overrides the default "Change {credential}" heading. Pass an empty string to omit the heading entirely. Defaults to a translated, schema-derived heading. |
import { ChangeCredential } from '@thunderid/react'
function AccountPage() {
return (
<div>
<h2>Security</h2>
<ChangeCredential />
</div>
)
}
export default AccountPage
Loading /
component
The Loading component renders its children while the authentication state is being determined. It checks the current authentication state and displays a loading indicator or custom content during the initial authentication check. Once authentication is complete, it renders optional fallback content or nothing by default. This makes it ideal for providing user feedback during the initial app load or authentication verification.
Props
| Name | Type | Description |
|---|---|---|
| children (required) | ReactNode | Content to render during authentication loading |
| fallback (optional) | ReactNode | Content to render once authentication is determined |
import { Loading } from '@thunderid/react'
function App() {
return (
<Loading>
<div>Checking authentication...</div>
</Loading>
)
}
export default App
SignInButton /
component
The SignInButton component initiates the sign-in flow when clicked. It automatically handles loading state, error handling, and supports custom UI via render props or direct children. You can customize its behavior and appearance using the preferences prop, including i18n overrides.
Props
| Name | Type | Description |
|---|---|---|
| children (optional) | ReactNode or function | Render prop function or ReactNode for button content |
| preferences (optional) | Preferences | Customization options for i18n, theming, etc. |
| onClick (optional) | function | Callback after sign-in is triggered |
import { SignInButton } from '@thunderid/react'
function App() {
return <SignInButton />
}
export default App
SignOutButton /
component
The SignOutButton component signs out the current user, clears their session, and revokes authentication tokens when clicked. It automatically handles loading state, error handling, and supports custom UI via render props or direct children. You can customize its behavior and appearance using the preferences prop, including i18n overrides.
Props
| Name | Type | Description |
|---|---|---|
| children (optional) | ReactNode or function | Render prop function or ReactNode for button content |
| preferences (optional) | Preferences | Customization options for i18n, theming, etc. |
| onClick (optional) | function | Callback after sign-out is triggered |
| redirectUrl (optional) | string | URL to redirect to after sign-out |
import { SignOutButton } from '@thunderid/react'
function App() {
return <SignOutButton />
}
export default App
SignUpButton /
component
The SignUpButton component triggers the sign-up (registration) flow when clicked. It automatically handles loading state, error handling, and supports custom UI via render props or direct children. You can customize its behavior and appearance using the preferences prop, including i18n overrides.
Props
| Name | Type | Description |
|---|---|---|
| children (optional) | ReactNode or function | Render prop function or ReactNode for button content |
| preferences (optional) | Preferences | Customization options for i18n, theming, etc. |
| onClick (optional) | function | Callback after sign-up is triggered |
| redirectUrl (optional) | string | URL to redirect to after sign-up |
| mode | 'redirect' \ | Sign-up mode |
| className (optional) | string | CSS class name |
| style (optional) | CSSProperties | Inline styles |
| disabled (optional) | boolean | Disable the button |
import { SignUpButton } from '@thunderid/react'
function LandingPage() {
return <SignUpButton />
}
export default LandingPage
SignedIn /
component
The SignedIn component conditionally renders its children only when the user is authenticated with Choreo Identity & Access Management. It checks the current authentication state and displays protected UI content for signed-in users, while rendering optional fallback content (or nothing by default) when the user is not authenticated. This makes it ideal for guarding routes or UI sections that require authentication.
Props
| Name | Type | Description |
|---|---|---|
| children (required) | ReactNode | Content to render when the user is signed in |
| fallback (optional) | ReactNode | Content to render when not signed in |
import { SignedIn } from '@thunderid/react'
function App() {
return (
<SignedIn>
<p>Welcome! You are signed in.</p>
</SignedIn>
)
}
export default App
SignedOut /
component
The SignedOut component conditionally renders its children only when the user is not authenticated with Choreo Identity & Access Management. It checks the current authentication state and displays content for unauthenticated users, while rendering optional fallback content (or nothing by default) when the user is authenticated. This makes it ideal for showing sign-in prompts, public landing pages, or content that should only be visible to guests.
Props
| Name | Type | Description |
|---|---|---|
| children (required) | ReactNode | Content to render when the user is signed out |
| fallback (optional) | ReactNode | Content to render when signed in |
import { SignedOut, SignInButton } from '@thunderid/react'
function App() {
return (
<SignedOut>
<div>
<h1>Welcome!</h1>
<SignInButton />
</div>
</SignedOut>
)
}
export default App
User /
component
The User component is a declarative way to access the authenticated user object from the Choreo Identity & Access Management authentication context. It uses render props to expose the user data, making it easy to display user information or conditionally render UI based on authentication state.
Props
| Name | Type | Description |
|---|---|---|
| children | (user: User \ | Render prop function that receives the user object |
| fallback (optional) | ReactNode | Content to render when no user is signed in |
import { User } from '@thunderid/react'
function App() {
return (
<User fallback={<p>Please sign in</p>}>
{(user) => (
<div>
<h1>Welcome, {user?.displayName}!</h1>
<p>Email: {user?.email}</p>
</div>
)}
</User>
)
}
export default App
UserDropdown /
component
The UserDropdown component renders a dropdown menu with user information and common actions like viewing profile, settings, and signing out.
Props
| Name | Type | Description |
|---|---|---|
| children (optional) | ReactNode | Custom menu items (defaults to standard items) |
| showAvatar (optional) | boolean | Show user avatar (defaults to true) |
| showName (optional) | boolean | Show user name (defaults to true) |
| showEmail (optional) | boolean | Show user email (defaults to true) |
import { UserDropdown } from '@thunderid/react'
function Header() {
return (
<header>
<UserDropdown />
</header>
)
}
export default Header
UserProfile /
component
The UserProfile component renders a complete user profile management interface where users can view and edit their personal information, change passwords, manage sessions, and more.
Props
| Name | Type | Description |
|---|---|---|
| appearance (optional) | Appearance | Customize component appearance |
| sections (optional) | string[] | Which sections to show (defaults to all sections) |
import { UserProfile } from '@thunderid/react'
function ProfilePage() {
return (
<div>
<h1>My Profile</h1>
<UserProfile />
</div>
)
}
export default ProfilePage
Was this page helpful?