Skip to content

Authentication

Lets a person sign in, recover access and create an account without losing their way or their data.

Authentication screens are short and quiet. They answer three questions: who are you, how do you prove it, and what if you cannot. The blocks here are interface patterns with invented local state. They make no network calls and check nothing real: the preview account and code are written on the screen.

Anatomy

  • The Logo above a plain heading, so the person knows where they are.
  • Field with Input for email, and Input Group for the password with a show and hide button.
  • Button for the main action and for single sign-on, with Spinner while it works.
  • Alert for a failed attempt, Input OTP for a one-time code, Checkbox for terms and keeping the session.

Sign in

Email and password, a single sign-on button, a show password toggle, Forgot password with its own two screens, and a neutral error when the details do not match.

Open in a new tab

Choose it as the default entry to an application. Put single sign-on first when the company has an identity provider, as most mid-market customers do.

Create account and verify

Name, work email, a password with requirements that tick as they are met, then a six-digit code sent by email. The code is checked on the sixth digit, a wrong code clears the field and returns focus to it, and a new code can be requested after a countdown.

Open in a new tab

Choose it when people join themselves. When an administrator invites them, skip the first step and start at the code.

Behaviour

  • Failed sign-in. The password is cleared, focus returns to it and an alert says the email and password do not match. It does not say which one is wrong.
  • Forgot password. The answer is the same whether or not the address has an account: "If it has an account, a reset link is on its way."
  • Code entry. Focus goes to the code field when the step opens. Paste works across all six slots.
  • Resend. The button is disabled with a visible countdown, then enabled.
  • Success. The heading takes focus and a single button continues.
  • Responsive. One narrow column that fills the width on a phone.
KeyAction
TabMoves focus to the next control, including the show password button.
EnterSubmits the form from a text field.
SpacePresses the focused button or toggles a checkbox.
BackspaceDeletes the last digit of the code.

On a phone

Both blocks put pointer-coarse:touch-controls on the whole screen. Sign-in, account creation and the one-time code are short, finger-first tasks: on a touch screen the fields, the code slots, the checkbox row and the actions reach 44px, and a mouse keeps the shipped sizes. See Sizing.

Accessibility

  • Email and password fields carry autocomplete values so password managers fill them, and the password field is never blocked from pasting.
  • The show password button has a label that changes with its state.
  • The code field has one real input behind the slots, with autocomplete="one-time-code" and a numeric keyboard.
  • Errors are announced by the alert and tied to the fields they describe.
  • Requirements are stated in words, and their state is also written for screen readers.

Content

  • Name the product and the company, not the technology: "Sign in", "Use your Brevia Manufacturing account".
  • Errors say what to do next: "Check both and try again, or reset your password."
  • Never confirm that an email has an account to someone who is not signed in.
Do

Say the details do not match and offer a way forward.

Don’t

Don’t tell a stranger which part was wrong or that an account exists.

Install

pnpm dlx shadcn@latest add @silkware/authentication-01
pnpm dlx shadcn@latest add @silkware/authentication-02