Circle V2 API Docs
    Preparing search index...

    Type Alias UseFormSetFocus<TFieldValues>

    UseFormSetFocus: <
        TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
    >(
        name: TFieldName,
        options?: SetFocusOptions,
    ) => void

    Set focus on a registered field. You can start to invoke this method after all fields are mounted to the DOM.

    Type Parameters

    Type Declaration

    APIDemo

    useEffect(() => {
    setFocus("name");
    }, [setFocus])
    // shouldSelect allows to select input's content on focus
    <button onClick={() => setFocus("name", { shouldSelect: true })}>Focus</button>