Sign In

Login form patterns with social authentication, two-factor input, and responsive layouts. Accessible and progressively enhanced.

Overview

Sign-in forms are critical user touchpoints that require careful attention to usability, accessibility, and security. These patterns demonstrate best practices using Vanilla Breeze's data-layout attributes and custom elements.

Key features:

  • data-layout attributes for layout without wrapper elements
  • <form-field> with validation messages using <output>
  • <text-divider> for separating authentication methods
  • <brand-mark> for consistent logo display
  • Progressive OTP enhancement with data-type="otp"
  • Proper autocomplete attributes for password managers
  • Password toggle (auto-enhanced by JS)

Simple Card Form

A centered login form using data-layout="cover" on the body for vertical centering, with <layout-card> constraining the width. The form itself uses data-layout="stack" for vertical spacing.

Split Screen Layout

A two-column layout using data-layout="split" with a branded panel alongside the form. The <brand-mark> element provides consistent logo display. Collapses to single column on mobile.

Brand Panel Styles

With Social Login

Sign-in form with social authentication buttons above traditional email/password fields. Uses the <text-divider> element to visually separate authentication methods.

Two-Factor Authentication

A verification code input using the progressive OTP enhancement. The input uses data-type="otp" and data-length="6" to enable multi-box display with JavaScript, while working as a standard text input without it.

Progressive Enhancement

The OTP input pattern provides graceful degradation:

  • Without JS: Standard text input accepting 6 digits
  • With JS: Multi-box UI with automatic focus advance, backspace navigation, and paste support

No custom JavaScript required - the <form-field> enhancement handles everything automatically when it detects data-type="otp".

Form Field Features

All these patterns use <form-field> which provides:

  • Validation icons: Checkmark/X appear after user interaction (disable with data-no-icon)
  • Password toggle: Show/hide button added automatically to password fields
  • Error messages: Use <output class="error"> with aria-live="polite"
  • Required indicator: Asterisk added automatically to required field labels

Usage Notes

  • Autocomplete: Use autocomplete="email" and autocomplete="current-password" for password manager support
  • OTP autocomplete: Use autocomplete="one-time-code" for SMS/app code autofill
  • Remember me: Include a checkbox for persistent sessions
  • Password recovery: Always provide a visible "Forgot password?" link
  • Social login: Use <icon-wc> with brand icons for recognizable buttons
  • Accessibility: All inputs have labels, validation messages use aria-live, and focus states are visible

Related

Registration

Sign up forms with password requirements

Form Field

Form field element with validation

Text Divider

Horizontal divider with text

Brand Mark

Brand/logo display element