Skip to main content

SignOutButton

The SignOutButton composable renders a pre-styled button that calls ThunderIDClient.signOut(), then calls ThunderIDState.refresh() to update the reactive auth state. It disables itself automatically while the sign-out operation is in progress.

SignOutButton requires ThunderIDProvider in its ancestor composable hierarchy.

Usage​

import dev.thunderid.compose.components.actions.SignOutButton

@Composable
fun HomeView() {
Column {
Text("You are signed in.")
SignOutButton()
}
}

Parameters​

ParameterTypeRequiredDescription
modifierModifier❌Compose modifier applied to the button.
onSignOutComplete(() -> Unit)?❌Called after sign-out completes and ThunderIDState has been refreshed.

Example: Handle Sign-Out Completion​

SignOutButton(
onSignOutComplete = {
// Navigate to the landing screen or perform cleanup
println("User has signed out")
}
)

Customization with BaseSignOutButton​

BaseSignOutButton is the unstyled variant. Use it to implement your own sign-out UI while delegating the actual sign-out logic to thunder.client.signOut().

import dev.thunderid.compose.components.actions.BaseSignOutButton
import dev.thunderid.compose.LocalThunderID

@Composable
fun CustomSignOutButton() {
val thunder = LocalThunderID.current
val scope = rememberCoroutineScope()

BaseSignOutButton(
label = "Log Out",
isLoading = thunder.isLoading,
modifier = Modifier.fillMaxWidth()
) {
scope.launch {
runCatching { thunder.client.signOut() }
thunder.refresh()
}
}
}

BaseSignOutButton Parameters​

ParameterTypeRequiredDescription
labelString✅The button label text.
isLoadingBoolean❌When true, the button is disabled. Defaults to false.
modifierModifier❌Compose modifier.
onClick() -> Unit✅Called when the button is tapped.

Explore with AI

ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© Copyright Linux Foundation Europe.For web site terms of use, trademark policy and other project policies please see https://linuxfoundation.eu/en/policies.