Use Case

The <hanko-auth> component provides a complete authentication solution that combines both login and registration functionality in a single interface. This component is ideal for applications that want to streamline their authentication process without needing separate routes or pages for different authentication flows. The component automatically handles transitions between login and registration views, providing a seamless user experience throughout the entire authentication process. If you want to create a dedicated Login page:
try out the<hanko-login> component.
If you want to create a dedicated Registration page:
try out the <hanko-register> component .

Features

Login + RegisterSeamlessly handles both flows in one component.
PasskeysEnables passwordless login with modern device credentials.
PasscodesUseful for email-based login and verification workflows.
2FAUsers can use a TOTP app or security keys.
OAuth SSOAllows users to log in using third-party identity providers (e.g., Google, Apple).
PasswordsSupports traditional password-based login for broader accessibility.

Usage

Markup

<hanko-auth></hanko-auth>

Attributes

NameDescription
prefilled-emailUsed to prefill the email input field
prefilled-usernameUsed to prefill the username input field
langUsed to specify the language of the content within the element
modeSpecify the starting flow, either registration or login

Adding <hanko-auth> component

The following examples show how to integrate the <hanko-auth> component in different full-stack and frontend frameworks.

Full Stack

components/HankoAuth.tsx
"use client"

import { useEffect } from "react";
import { register } from "@teamhanko/hanko-elements";

const hankoApi = process.env.NEXT_PUBLIC_HANKO_API_URL;

export default function HankoAuth() {
  useEffect(() => {
   register(hankoApi)
      .catch((error) => {
        // handle error
      });
  }, []);

return (
<hanko-auth />
);
}

Frontend

components/HankoAuth.tsx
import { useEffect } from "react";
import { register } from "@teamhanko/hanko-elements";

const hankoApi = process.env.REACT_APP_HANKO_API_URL;

export default function HankoAuth() {
  useEffect(() => {
    register(hankoApi).catch((error) => {
      // handle error
    });
  }, []);

  return <hanko-auth />;
}
You should see an interface similar to this 👇
sign-up
For more detailed instructions on integrating <hanko-auth> component with your favorite frameworks, navigate to quickstart guides.