UNPKG

@tiller-ds/patterns

Version:

Patterns module of Tiller Design System

70 lines (69 loc) 2.35 kB
import * as React from "react"; import { ComponentTokens } from "@tiller-ds/theme"; declare type InitialValues = { username: string; password: string; }; declare type InitialValuesEmail = { email: string; password: string; }; declare type LoginProps = { /** * Determines the text displayed inside the button for logging in. */ buttonText?: string; /** * Optional components displayed above the title. */ children?: React.ReactNode; /** * Optional class name for changing the look of the login form. * Overrides the default container class name (tokens: Login.container). */ className?: string; /** * Toggle for changing the look of the form to a use case where the * password is forgotten. * Defaults to false. */ forgotPassword?: boolean; /** * Specifies the URL or navigation link to redirect the user when * they click on a "Forgot Password" link. */ forgotPasswordLink?: string; /** * Function that handles values inputted into the component on submit. */ handleSubmit: (values: any) => void; /** * Determines initial values for the login form. Initial values vary depending * on the login variant (with username / with email) */ initialValues: InitialValues | InitialValuesEmail; /** * Enables the display of logo. Requires an 'svg' file. */ logo?: string; /** * Toggle which determines whether the checkbox for 'Remember Me' is displayed on component render. * Defaults to false. */ rememberMe?: boolean; /** * Title displayed centered above the input fields. */ title?: string; /** * Toggle for changing the required info to email and password as opposed to username and password * by default. * Note: initialValues prop must be of 'InitialValuesEmail' type if this toggle is enabled. */ useEmail?: boolean; } & LoginTokensProps; declare type LoginTokensProps = { tokens?: ComponentTokens<"Login">; }; export default function Login({ title, logo, rememberMe, buttonText, forgotPassword, forgotPasswordLink, initialValues, handleSubmit, children, useEmail, className, ...props }: LoginProps): JSX.Element; export {};