A warm, light Bootstrap 6 login card with an email field, a show/hide password toggle, a "Remember me" checkbox and a "Forgot password?" link. It fits shop accounts, member areas and SaaS sign-in pages. When "Remember me" is checked, the card also recalls the email on the next visit and offers a "Not you?" reset.
How it works
The root .lrm-root centers one .lrm-card on a dotted cream background. The email field uses the Bootstrap 6 form-adorn pattern: a <label class="form-control form-adorn"> wraps an envelope icon in .form-adorn-icon and a borderless .form-ghost input. The password sits in an .input-group with an input-group-btn reveal button. "Remember me" is a plain .check inside a .form-field with a .form-field-content column for the label and hint.
script.js is an ES module. On submit it calls preventDefault(), then checks each field with checkValidity() and toggles .is-invalid and aria-invalid. Bootstrap 6 shows the matching .invalid-feedback for adorned fields and input groups. Once a field has been flagged, it is checked again on every keystroke. The .lrm-reveal button switches the input type and updates aria-pressed, the label and the icon. A keydown/keyup listener reads getModifierState('CapsLock') and shows .lrm-caps.
A valid submit shows the spinner, waits for a simulated request and then shows the .lrm-success alert. If remember is checked, the email is saved to localStorage under lrm-remembered-email and the .lrm-remembered strip appears with an avatar initial. All storage access is wrapped in try/catch, so the form still works in sandboxed iframes and private windows.
Customization
--lrm-greenand--lrm-green-darkon.lrm-root: change the brand color. The same block maps them to--bs-primary-*and--bs-control-checked-bg, so the button and checkbox follow.--lrm-bg,--lrm-cardand--lrm-lineon.lrm-root: set the page background, card surface and borders.STORAGE_KEYat the top ofscript.js: rename the storage key, or remove thestore.set()call to keep the checkbox purely server-side.- Replace the
setTimeoutin the submit handler withfetch('/api/login', { method: 'POST', body: new FormData(form) })and sendrememberto the server so it can issue a longer session cookie. minlength="8"on#lrm-password: change the minimum length. Update the.invalid-feedbacktext to match.- Remove
checkedfrom#lrm-rememberto make "Remember me" opt-in.
Use cases
- Shop accounts: email, password and a Forgot password link in one clean card
- Member areas: a Remember me checkbox recalls the email on the next visit
- SaaS sign-in pages: a show/hide toggle and Caps Lock hint help users type passwords correctly
- Returning visitors: a Not you? link resets the remembered email
Accessibility
Every input has a visible label. Error messages are linked with aria-describedby, and aria-invalid is set together with .is-invalid. Focus moves to the first invalid field. The reveal button is a real <button> with aria-pressed and a changing aria-label. The success alert uses role="status", so screen readers announce it. Links and buttons have visible focus outlines. The arrow hover animation is turned off under prefers-reduced-motion.
Bootstrap 6 notes
btn-primary becomes btn-solid theme-primary, and form-check with form-check-input becomes a single .check inside .form-field. The mb-3 wrapper is replaced by .form-field, and form-adorn with form-ghost replaces the old icon-in-input workarounds. Built on Bootstrap 6.0.0-alpha.1, so class names may still change. Icons come from Bootstrap Icons.