Skip to content

useUI

Control and navigate the Openfort modal UI (routes, opening/closing modal).

Use cases:
  • Open the modal to specific pages: profile, wallets, providers, switch networks.
  • Programmatically control modal state and navigation.
Returns:
  • isOpen, open, close, setIsOpen: Modal control.
  • openProfile, openSwitchNetworks, openProviders, openWallets: Open specific modal routes.
import { useUI } from "@openfort/react"
 
function SampleComponent() {
  const {
    isOpen,
    open, // Open a UI component.
    close, // Close a UI component.
    setIsOpen,
    openProfile, // Open the user profile UI. If the user is not authenticated, it will open the login UI.
    openSwitchNetworks, // Open the switch networks UI.
    openProviders, // Open the auth providers UI.
    openWallets, // Open the wallets UI.
  } = useUI()
  // ...
}