A dark-themed login form with an animated show/hide password toggle. Clicking the eye icon sweeps a "torch beam" across the password field, and the field switches between hidden and visible text while the beam passes over it.
Built with plain HTML, CSS, and JavaScript. No frameworks, no build step.
- Show/hide password toggle using an eye icon inside the input
- Torch-beam and glow animation when the password is revealed
- Card border glow and input highlight while the password is visible
- Icon swaps between "eye" and "eye-off", with a short spark animation on each click
- Accessible toggle button:
aria-labelandaria-pressedupdate on every click - Responsive layout for small screens
- Respects
prefers-reduced-motion - Custom fonts: Fraunces (headings) and JetBrains Mono (body)
- HTML5
- CSS3 (custom properties, gradients,
clip-path,mix-blend-mode, keyframe animations) - Vanilla JavaScript
- Google Fonts
password_eye_icon/
├── index.html # Login form markup and inline SVG icons
├── styles.css # Theme, layout, beam and glow animations
└── script.js # Toggle logic for the eye button
- Clone the repository:
git clone https://github.com/niraj5511/password_eye_icon.git cd password_eye_icon - Open
index.htmlin your browser.
No installation or build is needed. An internet connection is needed to load the Google Fonts; without it, the page falls back to default fonts.
script.js listens for clicks on the eye button and toggles a shown state. On each click it:
- Plays the spark animation on the button.
- Adds or removes the
on,ring, andlitclasses, which trigger the CSS beam, card glow, and input highlight. - After 260 ms, switches the input
typebetweenpasswordandtext, swaps the icon, and updates the ARIA attributes. The delay makes the change land while the beam is passing over the field.
- Colors: edit the CSS variables at the top of
styles.css(--torch,--torch-core,--torch-deep,--bg, and so on). - Timing: change the transition durations on
.beam-leftand.bulb-glowinstyles.css, and the260ms delay inscript.js.
- This is a front-end demo only. The form does not submit (
onsubmit="return false;") and there is no authentication. - "Remember me", "Forgot password?", and "Create an account" are not connected to anything.