Jenga Otp Resend
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
time left before a new code can be requested.
called when the resend action is tapped.
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.
the resend action label.
the Modifier for the row.
whether a resend is in progress; shows a spinner and blocks repeat taps.
whether the resend action can be tapped.
the countdown and action text style.
the color set; defaults to JengaOtpResendDefaults.colors.
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",
)