Conditional reveal

조건부 노출

Progressive disclosure driven by what the user typed: the next option that fits it (e.g. "send me a copy by email" after an address is entered) appears in place.

Also known as: Conditional logicContextual revealDependent field입력에 따른 노출
···
html
<div class="card">
  <label>Email<div class="inp"><span id="t"></span><i class="caret"></i></div></label>
  <div class="opt" id="opt"><span class="box" id="box"></span>메일로 사본 받기</div>
  <button>Submit</button>
</div>
css
.card{width:min(86%,360px);padding:5%;border:1px solid var(--line);border-radius:14px;background:var(--surface);display:flex;flex-direction:column;gap:10px;font:600 clamp(10px,3.4vmin,14px) sans-serif;color:var(--fg)}
.inp{margin-top:4px;height:2.4em;border:1px solid var(--line);border-radius:8px;background:var(--bg);display:flex;align-items:center;padding:0 10px;font-weight:500}
.caret{width:1px;height:1.2em;background:var(--fg);margin-left:1px;animation:bl 1s steps(1) infinite}
@keyframes bl{50%{opacity:0}}
.opt{display:flex;align-items:center;gap:8px;max-height:0;opacity:0;overflow:hidden;transition:max-height .4s ease,opacity .4s ease;font-weight:500}
.opt.on{max-height:3em;opacity:1}
.box{width:1.1em;height:1.1em;border:1.5px solid var(--accent);border-radius:4px;display:inline-block;transition:background .3s}
.box.on{background:var(--accent)}
button{align-self:flex-start;border:0;border-radius:8px;padding:.6em 1.2em;background:var(--accent);color:#fff;font:inherit}
js
const text='hello@atlas.dev',t=document.getElementById('t'),opt=document.getElementById('opt'),box=document.getElementById('box');
const wait=ms=>new Promise(r=>setTimeout(r,ms));
(async()=>{for(;;){t.textContent='';opt.classList.remove('on');box.classList.remove('on');await wait(900);
  for(const ch of text){t.textContent+=ch;await wait(110);if(t.textContent==='hello@atlas.dev')opt.classList.add('on')}
  await wait(700);box.classList.add('on');await wait(1800);
  while(t.textContent.length){t.textContent=t.textContent.slice(0,-1);await wait(35);if(t.textContent.indexOf('@')<0)opt.classList.remove('on')}
  await wait(500)}})();

Where progressive disclosure (→ progressive-disclosure) expands when you press "Show more," conditional reveal is **keyed on the user's input.** Before an address is typed there is no "email me a copy" option; the moment a valid address arrives it eases into view. Users never hunt for a button — the next step opens itself.

Three rules: the **trigger must be unambiguous** (a valid email format, a specific choice); the revealed element must **not shove the layout** — reserve room or expand smoothly; and clearing the value should **hide it again**, with a decision on whether sub-values already entered are kept.

Mind accessibility: announce the new element to screen readers via an `aria-live` region or `aria-expanded`/`aria-controls`.

When to use

Use it in sign-up, checkout and contact forms whose next question depends on an answer. Keep the core path visible from the start — users may not know options are hidden.

Open as page ↗

Suggest an entry

Tell us about a term, effect or component that’s missing. We read every suggestion.