Session Inactivity Timeout with Countdown
Display an accessible warning modal with a ticking countdown timer and extend session action.
Display an accessible session expiration modal with a live countdown bar and one-click session renewal.
export async function promptSessionTimeout(logoutCallback: () => void) { const res = await ui.confirm({ title: 'Session Expiring Soon', text: 'You have been inactive. For your security, you will be logged out in 30 seconds.', tone: 'warning', timer: 30000, timerProgressBar: true, confirmButton: { label: 'Keep Me Logged In' }, cancelButton: { label: 'Log Out Now' }, });
if (res.isConfirmed) {
await renewAuthToken();
toast.success('Session extended successfully.');
} else {
logoutCallback();
}
}
`
Want to test these options live?
Launch the interactive playground to experiment with themes, positions, and live generators.