Skip to main content
Version: 2.0.0

LoginModal

The login modal is used to authenticate a registered user on your site.

Loading...
Trigger login modal from a button

Login modal can be triggered from anywhere on your site by adding pelcro-login-button class to any button.
Read more about Pelcro HTML buttons

Usage#

import React from "react";
import {
LoginModal,
PelcroModalController,
usePelcro,
} from "@pelcro/react-pelcro-js";
import "@pelcro/react-pelcro-js/dist/pelcro.css";
export const LoginExample = () => {
const { switchView } = usePelcro();
return (
<>
<button onClick={() => switchView("login")}>Click to login</button>
<PelcroModalController>
<LoginModal />
</PelcroModalController>
</>
);
};

Reference#

Props#

onDisplay#

() โ‡’ void

Callback function called when the modal is first displayed.

onClose#

() โ‡’ void

Callback function called when the modal is closed.

onSuccess#

(userObject) โ‡’ void

Callback function called when the user logs in succesfully.

onFailure#

(errorObject) โ‡’ void

Callback function called when the login fails.