Skip to main content

LoginCard

import { LoginCard } from '@enmovil/ui-design-system';

A complete sign-in screen covering login, OTP entry, forgotten and reset passwords, and setting a new password, selected with authStep. It can also show a captcha and a single sign-on button, and its layout and branding are configurable.

Properties​

PropertyTypeRequiredDefaultAllowed valuesDescription
logostringNo——Image source of the logo at the top of the card, shown on the login step only. Falls back to the bundled Enmovil logo; a logo set in layout.branding takes precedence.
logoHeightnumberNo——Height of the logo in pixels. Without it the logo keeps its default height; a height set in layout.branding takes precedence.
titlestringNo——Heading of the card, used for every step. Without it each step shows its own heading (for example "Welcome back" on login); an empty string hides it.
subtitlestringNo——Text under the heading, used for every step. Without it each step shows its own subtitle (for example "Sign in to continue" on login); an empty string hides it.
loginIdentifier{ label?: string; placeholder?: string; } | undefinedNo——Label and placeholder of the identifier field on the login and enter-email steps. Without it the field is labelled "Email" with the placeholder "Enter email"; the label is also used in the step's subtitle and error message.
backgroundImagestringNo——Image source shown as a full-page background, scaled to cover. Only applies when layout is set and defines no background layers; the default layout always has its own background, so the image is not shown without layout.
helperLogostringNo——Image source of the secondary logo, shown in the top-right corner of the page in the default layout. Falls back to a bundled image; a logo set in layout.branding takes precedence.
helperLogoHeightnumberNo——Height of the secondary logo in pixels. Only applies when layout is set and gives the helper logo no height; the default layout fixes it at 34px.
layoutLoginLayoutConfigNo——Configuration of the page around the card, such as background layers, card placement, branding, decorations and per-breakpoint overrides. Without it the page uses the standard Enmovil layout. Invalid values fall back to defaults.
classNamestringNo——Extra CSS class added to the page's root element.
forgotPathnamestringNo'#'—Declared, but not used by the component.
isCaptchabooleanNofalse—Shows a captcha under the password field on the login step. The captcha must be solved before onSubmit is called.
authStepstringNo'login''new-password', 'login', 'otp', 'enter-email', 'enter-login-id', 'reset-password'Which form the card shows: login, otp, enter-email (forgotten password), enter-login-id, new-password or reset-password. Defaults to login.
otpLengthnumberNo6—Number of OTP digits on the otp step, kept between 4 and 8. Defaults to 6.
enableResendOtpbooleanNotrue—Shows a Resend OTP link on the otp step, after a countdown of resendOtpInterval seconds. Defaults to true.
resendOtpIntervalnumberNo30—Seconds to wait before Resend OTP can be clicked, counted from when the otp step opens and after each resend. Defaults to 30. Requires enableResendOtp.
showSSOLoginbooleanNofalse—Shows a single sign-on button below the login form on the login step.
ssoLoginLabelstringNo'Sign in with Microsoft'—Text of the single sign-on button, also the alt text of its icon. Defaults to "Sign in with Microsoft". Requires showSSOLogin.
ssoLoginIconstringNo——Image source of the icon on the single sign-on button. Falls back to a bundled Microsoft icon. Requires showSSOLogin.

Events​

NameSignatureWhen it fires
onForgotPasswordClick(() => void)Fires when the Forgot Password? link on the login step is clicked. Set authStep from it to move to the next step.
onSubmit((email: string, password: string) => void)Fires with the identifier and password when the login form is submitted (button or Enter), once both are filled in and any captcha is solved.
onOtpSubmit((otp: string) => void)Fires with the entered OTP when Verify is clicked and all otpLength digits are filled in.
onResendOtp(() => void)Fires when Resend OTP is clicked. The entered OTP is cleared and the countdown restarts.
onEmailSubmit((email: string) => void)Fires with the entered identifier when the enter-email form is submitted (button or Enter) and the field is not empty.
onLoginIdSubmit((loginId: string) => void)Fires with the entered login ID when the enter-login-id form is submitted (button or Enter) and the field is not empty.
onNewPasswordSubmit((password: string) => void)Fires with the new password when the new-password form is submitted and both fields are filled in and match.
onResetPasswordSubmit((oldPassword: string, newPassword: string) => void)Fires with the current and the new password when the reset-password form is submitted and both fields are filled in.
onSSOLoginClick(() => void)Fires when the single sign-on button is clicked. Requires showSSOLogin.

Children​

LoginCard does not accept children.

Variants​

Loading examples…

Playground​

Change the controls to see how the properties affect the component. Values the controls don't cover come from the Default example.

Loading playground…

Storybook​

Open LoginCard in Storybook to try every story with the full set of controls.