Skip to content
Alchemy Logo

useAuthModal

function useAuthModal(): object;

Defined in: account-kit/react/src/hooks/useAuthModal.ts:31

A hook that returns the open and close functions for the Auth Modal if uiConfig is enabled on the Account Provider

import React from "react";
import { useAuthModal } from "@account-kit/react";
 
const ComponentWithAuthModal = () => {
  const { openAuthModal } = useAuthModal();
 
  return (
    <div>
      <button onClick={openAuthModal}>Login</button>
    </div>
  );
};

object

an object containing methods for opening or closing the auth modal. ref

NameType

closeAuthModal()

() => void

isOpen

boolean

openAuthModal()

() => void

Was this page helpful?