JengaOtpResend

fun JengaOtpResend(remaining: Duration, onResend: () -> Unit, countdownText: String, resendText: String, modifier: Modifier = Modifier, sending: Boolean = false, enabled: Boolean = true, textStyle: TextStyle = JengaOtpResendDefaults.textStyle, colors: JengaOtpResendColors = JengaOtpResendDefaults.colors(), contentPadding: PaddingValues = JengaOtpResendDefaults.contentPadding)(source)

The "resend code" row under a JengaOtpField: a countdown while remaining is positive, then a resend action.

Stateless: the caller owns the time. Use rememberJengaCountdown for a screen-local countdown, or pass a value computed from a deadline held in a view model so it survives configuration changes.

Parameters

remaining

time left before a new code can be requested.

onResend

called when the resend action is tapped.

countdownText

the text shown while waiting. Build it from remaining on each recomposition, e.g. "Resend code in ${JengaOtpResendDefaults.formatRemaining(remaining)}", so string resources work as usual.

resendText

the resend action label.

modifier

the Modifier for the row.

sending

whether a resend is in progress; shows a spinner and blocks repeat taps.

enabled

whether the resend action can be tapped.

textStyle

the countdown and action text style.

colors

the color set; defaults to JengaOtpResendDefaults.colors.

contentPadding

padding around the row.

Samples

val countdown = rememberJengaCountdown(
    duration = 5.minutes,
)
val remainingText = JengaOtpResendDefaults.formatRemaining(
    remaining = countdown.remaining,
)
JengaOtpResend(
    remaining = countdown.remaining,
    onResend = { countdown.restart() },
    countdownText = "Resend code in $remainingText",
    resendText = "Resend code",
)