UserButton

The UserButton is a circular button that displays the signed-in user's profile image. When tapped, it presents a sheet with the UserProfileView.
- Name
clerkTheme- Type
ClerkTheme- Description
The theme to apply to the
UserButton. This will override any theme applied to theUserButton's parent view, or configured in theClerkglobal object.
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.clerk.api.Clerk
import com.clerk.ui.userbutton.UserButton
@Composable
fun HomeScreen() {
val user by Clerk.userFlow.collectAsStateWithLifecycle()
if (user != null) {
UserButton()
}
}import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.clerk.api.Clerk
import com.clerk.ui.userbutton.UserButton
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun UserProfileTopBar() {
val user by Clerk.userFlow.collectAsStateWithLifecycle()
Scaffold(
topBar = {
TopAppBar(title = { Text("Home screen") }, actions = { user?.let { UserButton() } })
}
) {
// Content goes here
}
}Customization
To learn how to customize Clerk views, see the dedicated guide.
If Clerk's prebuilt views don't meet your specific needs or if you require more control over the logic, you can rebuild the existing Clerk flows using the Clerk API. For more information, see the custom flow guides.
Feedback
Last updated on