/** * Result object returned by {@link usePasskeyAutofill}. * * Provides a ref that can be attached to the username `` element * to automatically enable browser Conditional UI (passkey autofill). * * @see {@link usePasskeyAutofill} * @category Passkeys * @public */ export interface UsePasskeyAutofillResult { /** * A React ref that can be bound to the username `` element. * * When attached, the SDK ensures the input’s `autocomplete` * attribute is correctly set to `"username webauthn"`. * * If the developer already declared this attribute in markup, * the ref is optional, the hook will still register Conditional * Mediation correctly even without it. */ inputRef: React.RefObject; } /** * React hook that enables browser **Conditional UI** (passkey autofill) * for the login identifier field on the `login-id` screen. * * --- * ### Behavior * - The hook automatically initializes the browser’s Conditional Mediation * API (`navigator.credentials.get({ mediation: "conditional" })`), * allowing passkeys stored on the user’s device to appear directly in * the username field’s autocomplete dropdown. * - It **fails silently** on unsupported browsers and **never blocks** user input. * - The registration is performed once per page lifecycle. * * --- * ### Using the returned `ref` * The returned `inputRef` is **optional**. * - If you bind it to your `` element, the SDK will ensure the element’s * `autocomplete` attribute is correctly set to `"username webauthn"`. * - If your input element **already has** * `autocomplete="username webauthn"` declared in markup, * you can skip binding the `ref` entirely, the hook will still register * Conditional Mediation correctly. See {@link UsePasskeyAutofillResult} * * --- * ### Example * ```tsx * import { usePasskeyAutofill } from '@auth0/auth0-acul-react/login-id'; * * export function LoginForm() { * // Option 1: bind the ref for automatic attribute handling * const { inputRef } = usePasskeyAutofill(); * * return ( * * ); * } * * // Option 2: works equally well without using the ref * export function LoginFormWithoutRef() { * usePasskeyAutofill(); // just call the hook once * * return ( * * ); * } * ``` * * --- * @supportedScreens * - `login-id` * * @category Passkeys */ export declare function usePasskeyAutofill(): UsePasskeyAutofillResult;