• Home
  • /
  • Modern Neumorphic Login & Signup Form with Dark Mode Toggle

Modern Neumorphic Login & Signup Form with Dark Mode Toggle | HTML CSS JS

HTML

				
					<!DOCTYPE html>
<html lang="en">
<head>

<meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Neumorphic Auth Form</title>
  <link rel="stylesheet" href="style.css" />
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" />
</head>
<body>

  <div class="container">

    <div class="theme-toggle-wrapper">
      <button class="theme-btn" id="themeToggle">
        <i class="fas fa-sun"></i>
      </button>
    </div>

    <div class="form-toggle">
      <button class="active" onclick="showForm('login')">Login</button>
      <button onclick="showForm('signup')">Sign Up</button>
    </div>

    
    <div class="form-box" id="loginForm">
      <h2>Login</h2>
      <div class="input-group">
        <i class="fas fa-envelope"></i>
        <input type="email" required />
        <label>Email</label>
      </div>
      <div class="input-group">
        <i class="fas fa-lock"></i>
        <input type="password" id="loginPassword" required />
        <label>Password</label>
        <i class="fas fa-eye toggle-password" onclick="togglePassword('loginPassword', this)"></i>
      </div>
      <button class="btn">Login</button>
      <div class="social-buttons">
        <div class='code-block code-block-2' style='margin: 8px 0; clear: both;'>
<template id="21vvrVFuHpdk5IuNjgoL"></template>
<ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-2094722033678002"
     data-ad-slot="2248279416"></ins>
<script type="bv_inline_delayed_js" bv_unique_id="3EoRcwKR8Vqm4k18XWvU" defer="1" data-cfasync="" bv_inline_delayed="1" async="">(adsbygoogle = window.adsbygoogle || []).push({});</script></div>
<p>Or continue with:</p>
        <div class="icons">
          <a class="facebook"><i class="fab fa-facebook-f"></i></a>
          <a class="google"><i class="fab fa-google"></i></a>
          <a class="github"><i class="fab fa-github"></i></a>
        </div>
      </div>
    </div>

    
    <div class="form-box hidden" id="signupForm">
      <h2>Sign Up</h2>
      <div class="input-group">
        <i class="fas fa-user"></i>
        <input type="text" id="signupName" required />
        <label for="signupName">Name</label>
      </div>
      <div class="input-group">
        <i class="fas fa-envelope"></i>
        <input type="email" required />
        <label>Email</label>
      </div>
      <div class="input-group">
        <i class="fas fa-lock"></i>
        <input type="password" id="signupPassword" required />
        <label>Password</label>
        <i class="fas fa-eye toggle-password" onclick="togglePassword('signupPassword', this)"></i>
      </div>
      <button class="btn">Register</button>
      <div class="social-buttons">
        <p>Or continue with:</p>
        <div class="icons">
          <a class="facebook"><i class="fab fa-facebook-f"></i></a>
          <a class="google"><i class="fab fa-google"></i></a>
          <a class="github"><i class="fab fa-github"></i></a>
        </div>
      </div>
    </div>

  </div>

  <template id="bBoRii5mzHXZZ1GIlpgB"></template>
</body>
</html>

				
			

CSS

				
					* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background: #e0e5ec;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: 0.4s;
}

/* Theme Toggle */
.theme-toggle-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 0;
  margin-top: -5px;
}

.theme-btn {
  background: #e0e5ec;
  border: none;
  padding: 10px;
  border-radius: 100%;
  box-shadow: inset 4px 4px 8px #bebebe, inset -4px -4px 8px #ffffff;
  cursor: pointer;
  transition: 0.3s;
  color: #333;
  font-size: 18px;
}

.theme-btn:hover {
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

body.dark .theme-btn {
  background: #2a2d32;
  color: #eee;
  box-shadow: inset 3px 3px 6px #1c1e21, inset -3px -3px 6px #3c4149;
}

/* Container */
.container {
  width: 90%;
  max-width: 420px;
  height: 600px;
  background: #e0e5ec;
  padding: 20px 30px 30px;
  border-radius: 20px;
  box-shadow: 10px 10px 30px #bebebe, -10px -10px 30px #ffffff;
  transition: 0.3s;
  overflow: hidden;
}

/* Form Toggle Buttons */
.form-toggle {
  display: flex;
  justify-content: center;
  margin-top: 30px;
}

.form-toggle button {
  flex: 1;
  padding: 12px;
  border: none;
  font-size: 16px;
  background: #e0e5ec;
  color: #444;
  border-radius: 20px;
  margin: 0 5px;
  box-shadow: inset 5px 5px 10px #bebebe, inset -5px -5px 10px #ffffff;
  cursor: pointer;
  transition: 0.3s;
}

.form-toggle button.active {
  color: #fff;
  background: linear-gradient(to right, #6a11cb, #2575fc);
  box-shadow: none;
}

/* Form Boxes */
.form-box {
  padding-top: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.form-box.hidden {
  display: none;
}

.form-box h2 {
  margin-bottom: 20px;
  color: #333;
}

/* Input Groups */
.input-group {
  position: relative;
  margin-bottom: 20px;
}

.input-group input {
  width: 100%;
  padding: 12px 45px 12px 40px;
  border: none;
  border-radius: 12px;
  background: #e0e5ec;
  box-shadow: inset 5px 5px 10px #bebebe, inset -5px -5px 10px #ffffff;
  color: #333;
}

.input-group label {
  position: absolute;
  top: 12px;
  left: 40px;
  color: #777;
  font-size: 14px;
  pointer-events: none;
  transition: 0.3s ease;
}

.input-group input:focus + label,
.input-group input:valid + label {
  top: -10px;
  left: 35px;
  font-size: 12px;
  background: #e0e5ec;
  padding: 0 5px;
  color: #333;
  border-radius: 3px;
  border: 1px solid #333;
}

/* Icons inside input */
.input-group i.fa-envelope,
.input-group i.fa-user,
.input-group i.fa-lock {
  position: absolute;
  top: 12px;
  left: 12px;
  color: #999;
}

.toggle-password {
  position: absolute;
  top: 12px;
  right: 12px;
  cursor: pointer;
  color: #999;
  font-size: 16px;
  transition: color 0.3s ease;
}

/* Buttons */
.btn {
  width: 100%;
  padding: 12px;
  border: none;
  background: linear-gradient(to right, #6a11cb, #2575fc);
  color: #fff;
  border-radius: 12px;
  cursor: pointer;
  font-size: 16px;
  margin-top: 10px;
}

/* Social Buttons */
.social-buttons {
  margin-top: 20px;
}

.social-buttons p {
  font-size: 14px;
  color: #666;
}

.icons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 10px;
}

.icons a {
  text-decoration: none;
  width: 40px;
  height: 40px;
  background: #e0e5ec;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  color: #333;
  box-shadow: 5px 5px 10px #bebebe, -5px -5px 10px #ffffff;
  transition: transform 0.3s;
}

.icons a:hover {
  transform: scale(1.1);
}

.facebook { color: #3b5998; }
.google   { color: #db4437; }
.github   { color: #333; }

/* Dark Mode Styles */
body.dark {
  background: #1a1c1f;
}

body.dark .container,
body.dark .theme-toggle-wrapper {
  background: #2a2d32;
  color: white;
  box-shadow: none;
}

body.dark .form-toggle button,
body.dark .input-group input,
body.dark .icons a {
  background: #2a2d32;
  color: #eee;
  box-shadow: inset 5px 5px 10px #191b1d, inset -5px -5px 10px #3b3f45;
}

body.dark .form-toggle button.active {
  background: linear-gradient(to right, #00c6ff, #0072ff);
  box-shadow: 0 0 10px rgba(0, 198, 255, 0.5);
}

body.dark .btn {
  background: linear-gradient(to right, #00c6ff, #0072ff);
}

body.dark .input-group label {
  background: #2a2d32;
  color: #eee;
}

body.dark .input-group input:focus + label,
.input-group input:valid + label {
  border: 1px solid #eee;
}

body.dark .form-box h2 {
  color: #eee;
}

body.dark .toggle-password {
  color: #bbb;
}

				
			

JavaScript

				
					document.addEventListener("DOMContentLoaded", function () {

  window.showForm = function (form) {
    const loginForm = document.getElementById('loginForm');
    const signupForm = document.getElementById('signupForm');
    const buttons = document.querySelectorAll('.form-toggle button');

    if (form === 'login') {
      loginForm.classList.remove('hidden');
      signupForm.classList.add('hidden');
      buttons[0].classList.add('active');
      buttons[1].classList.remove('active');
    } else {
      loginForm.classList.add('hidden');
      signupForm.classList.remove('hidden');
      buttons[0].classList.remove('active');
      buttons[1].classList.add('active');
    }
  };

  window.togglePassword = function (id, icon) {
    const input = document.getElementById(id);
    const type = input.type === 'password' ? 'text' : 'password';
    input.type = type;
    icon.classList.toggle('fa-eye');
    icon.classList.toggle('fa-eye-slash');
  };

  const themeToggle = document.getElementById('themeToggle');
  themeToggle.addEventListener('click', () => {
    document.body.classList.toggle('dark');
    const icon = themeToggle.querySelector('i');
    icon.classList.toggle('fa-sun');
    icon.classList.toggle('fa-moon');
  });

});

				
			

Share this post

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top