Sign in

A sign-in screen for lit-material: password, a code by mail, creating an account and resetting a password, with single sign-on buttons.

  • 12.0 KB gzipped
  • @lit-material/sign-in 1.8.0
  • Renders on the server

Example

Install

npm install @lit-material/sign-in @lit-material/tokens
import "@lit-material/sign-in";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-sign-in>

A sign-in screen: email and password, a code sent by mail, creating an account and resetting a forgotten password, with room for "Continue with Google" style buttons. It only collects input: listen for lit-material-sign-in, call your server, then set busy, error, notice or awaiting-code from the answer.

Properties

PropertyAttributeTypeDefaultDescription
modemodeSignInMode"sign-in"Which flow is showing.
methodmethodSignInMethod"password"How to sign in, in mode="sign-in".
methodsmethodsstring"password"What the server offers, space-separated: password, code (a sign-in code by mail), sign-up, forgot. Links to the other views appear only for these.
emailemailstring""The address, kept across views. Set it to prefill.
awaitingCodeawaiting-codebooleanfalseThe code is mailed: ask for it (and the new password when resetting).
busybusybooleanfalseA request is running: the form is off and the button says so.
errorerrorstring""The server's refusal, shown above the form.
noticenoticestring""A note shown above the form, e.g. "Password changed. Sign in with the new one."
headingheadingstring""Overrides the heading of the current view.
codeLengthcode-lengthnumber6Characters in the mailed code.
passwordMinlengthpassword-minlengthnumber8Shortest password accepted when creating one.

Events

EventDescription
lit-material-sign-in-view-changeThe reader switched view; detail is { mode, method }.
lit-material-sign-inThe form was submitted; detail is SignInDetail.

Slots

SlotDescription
logoAbove the heading.
providersSingle sign-on buttons, shown above the form with an "or" divider.
footerUnder everything: terms, the server in use, help links.

CSS parts

PartDescription
cardThe outer box.
formThe form.

CSS custom properties

PropertyDescription
--lit-material-sign-in-widthWidth of the card (default 400px, never wider than its container).

Source on GitHub npm