<UserProfile /> component
The <UserProfile /> component is used to render a beautiful, full-featured account management UI that allows users to manage their profile, security, and Billing settings.
Example
The following example includes a basic implementation of the <UserProfile /> component. You can use this as a starting point for your own implementation.
Expo Router requires a non-platform route alongside a platform-specific route, so this example also includes src/app/user-profile.tsx, which renders the native <UserProfileView /> component on iOS and Android. Because users can sign out from <UserProfileView />, the example watches the auth state and redirects once they do.
import { UserProfileView } from '@clerk/expo/native'
import { useAuth } from '@clerk/expo'
import { useRouter } from 'expo-router'
import { useEffect } from 'react'
export default function Page() {
const { isLoaded, isSignedIn } = useAuth({ treatPendingAsSignedOut: false })
const router = useRouter()
useEffect(() => {
if (isLoaded && !isSignedIn) {
router.replace('/')
}
}, [isLoaded, isSignedIn, router])
return <UserProfileView isDismissible={false} style={{ flex: 1 }} />
}import { UserProfile } from '@clerk/expo/web'
export default function Page() {
return <UserProfile />
}Properties
All props are optional.
- Name
appearance?- Type
Appearance | undefined- Description
An object to style your components. Will only affect Clerk components and not Account Portal pages.
- Name
routing?- Type
'hash' | 'path'- Description
The routing strategy for your pages. Defaults to
'path'for frameworks that handle routing, such as Next.js. Defaults tohashfor all other SDK's, such as React.
- Name
path?- Type
string- Description
The path where the component is mounted on when
routingis set topath. It is ignored in hash-based routing. For example:/user-profile.
- Name
additionalOAuthScopes?- Type
object- Description
Specify additional scopes per OAuth provider that your users would like to provide if not already approved. For example:
{google: ['foo', 'bar'], github: ['qux']}.
- Name
customPages?- Type
CustomPage[]- Description
An array of custom pages to add to the user profile. Only available for the JavaScript SDK. To add custom pages with React-based SDK's, see the dedicated guide.
- Name
fallback?- Type
ReactNode- Description
An element to be rendered while the component is mounting.
Rather than render the full <UserProfile /> component, you can assemble your own account management page from smaller building blocks. Wrap them in a <UserProfileProvider> and render only the panels and sections you need, in whatever order suits your app.
The composable components are imported from @clerk/ui, which isn't included with your Clerk SDK — install it as a direct dependency:
npm install @clerk/uipnpm add @clerk/uiyarn add @clerk/uibun add @clerk/uiimport {
UserProfileProvider,
UserProfileAccountPanel,
UserProfileProfileSection,
UserProfileEmailSection,
UserProfilePhoneSection,
} from '@clerk/ui/experimental'
export default function UserProfilePage() {
return (
<UserProfileProvider>
<UserProfileAccountPanel>
<UserProfileProfileSection />
<UserProfileEmailSection />
<UserProfilePhoneSection />
</UserProfileAccountPanel>
</UserProfileProvider>
)
}Rendering a panel without children renders its built-in page content, the same sections the default <UserProfile /> renders on that page. The composed components don't include <UserProfile />'s navigation, so your app owns the layout and how users move between panels.
Customization
To learn about how to customize Clerk components, see the customization documentation.
In addition, you also can add custom pages and links to the <UserProfile /> navigation sidenav. For more information, refer to the Custom Pages documentation.
Feedback
Last updated on