Forms✨ Premium

Glow Input

The active field wraps itself in a double indigo glow — a crisp 4 px ring and a soft 20 px haze — that fades as soon as you move on.

CSSBox-shadowFocus

Updated

This effect is part of Effect.Labs — 840 vanilla effects, some free, some premium. Forms has 20 effects, including 2 free. Explore the category →

3 usage examples

Central search on a documentation home page — Zephrane — Glow Input example 1

① Central search on a documentation home page — Zephrane

WhenThe developer lands on the home page and presses Ctrl+K: the large field lights up in the middle of the page; as they type "webhooks", the matching section lights up below.
WhyA lone 400 px field in the middle of a dark page is the docs' front door; the glow makes it stand out at the exact moment the shortcut activates it.
SettingsRoot as a 400 px <form role="search">, --glw-width: 100%, no .glw-caption: aria-label="Search the documentation" and aria-keyshortcuts="Control+K". Listening for Ctrl+K and highlighting the section are scene code.
Loan amount in a mortgage simulator — Banque Aldrevin — Glow Input example 2

② Loan amount in a mortgage simulator — Banque Aldrevin

WhenThe borrower clicks the amount and types 185,000: the monthly payment is recalculated on every digit in the next panel (fixed 3.45% over 20 years) and the field glows while it is being edited.
WhyIn a simulator, the value being adjusted is what matters; the glow shows which figure drives the result displayed on the right.
SettingsThe left card is the root (background and padding from the scene), --glw-width: 100%, inputmode="numeric", starting value 150,000. The payment calculation listens to the input event, with a €10,000 minimum below which the result shows "—".
Typed answers in a live quiz — Quizzarde — Glow Input example 3

③ Typed answers in a live quiz — Quizzarde

WhenThree stacked questions, a score at the top; the player answers and presses Enter, a green tick confirms the line and the glow jumps to the next field.
WhyWhen several identical fields follow each other, the glow shows at a glance which one is waiting for an answer, with no number to reread.
SettingsOne root for the list; the scene lays out each .glw-field as a grid (question on the left, 190 px field on the right). A keydown listener on Enter adds 20 points and focuses the next question.

How it works

At rest, .glw-input has a thin 1 px frame in rgba(99, 102, 241, .3), 10 px corners and a barely indigo fill. Nothing reaches outside its box.

The .glw-input:focus rule adds two comma-separated shadows in box-shadow: 0 0 0 4px rgba(99, 102, 241, .2), a solid unblurred ring that follows the rounded corners, then 0 0 20px rgba(99, 102, 241, .3), a blurred haze spreading around. The frame turns solid #6366f1 at the same time. A single 0.3 s transition on all properties brings the whole thing up and down.

A shadow takes no room in the layout: the glow overflows by about 20 px without pushing neighbouring elements, but a tight parent with overflow: hidden will clip it. The .glw-caption label above the field is its visible name. The .fx-0293-root root is only a demo background.

Accessibility

  • Label: "Your name" sits in the <label> containing the field; the old example text ("Click to see the glow…") is gone in favour of a real name.
  • Form: name="name" and autocomplete="name", for submission and autofill.
  • Focus visibility: on a dark background the glow shows well; on white, a ring at 20% opacity and a haze at 30% turn pale. Raise those opacities (0.35 and 0.45, for example) if your page is light.
  • Reduced motion: with prefers-reduced-motion: reduce, the glow appears and disappears without a fade.
  • Several fields: only the focused field glows, which helps keyboard users follow their progress through a long list of questions.

Browser compatibility

Multiple box-shadow layers, a transition and one width variable: Chrome 49, Firefox 31, Safari 9.1. Checked in Chromium, Firefox and WebKit with two copies of the field (only the clicked second one glows), by keyboard, touch, at 390 px and with reduced motion. In the captures, the Ctrl+K shortcut, the typing and the move to the next question are simulated by each scene's script; that script is not sold with the effect.

Chrome 49+✓ Full (measured)
Firefox 31+✓ Full (measured)
Safari 9.1+✓ Full (WebKit engine measured)
Edge 79+✓ Full (Chromium engine)
Mobile iOS 9.3+✓ Full
Android Chrome 49+✓ Full (Chromium engine)

Without a transition, the glow switches on and off at once. In forced-colours mode (Windows), shadows are removed: add outline: 2px solid transparent on focus so a system outline stays visible.

The code

HTML structure to paste into your page (the CSS + JS come with your purchase):

index.html — structure
<div class="fx-0293-root">
  <label class="glw-field">
    <span class="glw-caption">Your name</span>
    <input class="glw-input" type="text" name="name" autocomplete="name">
  </label>
</div>

One-time payment, no subscription — the code is yours forever

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
Crisp ring (CSS — first shadow of the :focus rule) 0 0 0 4px rgba(99, 102, 241, .2) The 4th number is the thickness. At 2 px the ring becomes a hairline; at 6 px, leave room between fields.
Soft haze (CSS — second shadow) 0 0 20px rgba(99, 102, 241, .3) The 3rd number is the blur. The bigger it is, the further the glow spills; make sure no parent clips it with overflow: hidden.
Colour (CSS) indigo 99, 102, 241 Appears four times: resting frame, focused frame, ring and haze. Replace all four with the same hue.
Width (CSS — --glw-width) 280 px 100% to fit a card or a search bar; capped by max-width: 100%.
Duration (CSS — transition of .glw-input) 0.3 s Plays when lighting up and fading out. A shorter value (0.15 s) suits a fast quiz better.
Visible label (HTML — .glw-caption) "Your name" above Remove it for a search bar and give the field an aria-label instead.

FAQ

A parent has overflow: hidden (or auto) and hugs the field. Give it at least 20 px of padding around the field, or drop the hidden overflow.
No. box-shadow is painted on top, outside the size calculation: neighbouring fields stay put when the glow appears.
Yes, with your own class, for example .glw-input.is-error { border-color: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, .2), 0 0 20px rgba(239, 68, 68, .3); }, added by your validation and linked to the message with aria-describedby.