PasskeyUsernameField
A username text field that offers the user's passkeys as keyboard suggestions (passkey autofill).
While the field is focused and the platform supports it (PasskeyCapabilities.autofill: Android 15 / API 35+, iOS 16+), the field keeps a SignInMode.Autofill request open:
Android: the passkey appears as a suggestion chip in the keyboard. The request is anchored to the field's own view, so this also works inside a
DialogorModalBottomSheet.iOS: the passkey appears in the QuickType bar above the keyboard. The field is a native
UITextFieldwith the username content type, because iOS only offers passkeys for real UIKit username fields.Other platforms: a plain Material 3 outlined text field; no request is made.
Picking a suggestion signs in and calls onSignedIn. Dismissing it is not an error: the field keeps offering passkeys, and tapping the field again brings the suggestion back. Losing focus or leaving composition withdraws the offer. Typing a username works as usual through value and onValueChange, so the field also serves the password or "continue with username" path.
Parameters
the text in the field.
called when the user edits the text.
fetches fresh WebAuthn request options JSON from your server (usually with an empty allowCredentials). Called for every new offer; the latest lambda is always used.
called with the assertion to send to your server.
applied to the field.
the passkeys implementation; defaults to rememberPasskeys. Pass a fake in previews and tests.
the field label.
called when autofill can't work: PasskeyError.NotSupported, PasskeyError.Misconfigured or PasskeyError.InvalidOptions (reported once, then the field stops offering passkeys), or an unexpected error such as requestOptions throwing (the field retries on the next focus or tap). Dismissals are never reported.
whether the field can be edited and focused; no passkeys are offered while disabled.