Press Feedback
A tactile press response: the element shrinks and darkens while held.
AI prompt
Build a set of three tappable elements with different sizes (a 44px button, a 120x120 tile, and a full-width list row) that show press feedback. While pressed (use :active plus pointer events for reliability on touch), the element scales to 0.97 (button), 0.96 (tile) and 0.99 (row) over 80ms ease-out and its background darkens by about 12%. On release it returns over 260ms with cubic-bezier(0.34,1.56,0.64,1) for a gentle rebound. If the pointer leaves while pressed, it also returns and no click is registered. Show a small counter that increases on each completed click to prove the action fired. Add -webkit-tap-highlight-color: transparent and touch-action: manipulation. For prefers-reduced-motion use only the darkening.About this pattern
Definition
A visual response applied while an element is being pressed: it scales down slightly and its surface darkens, then returns on release. It makes the interface feel like a physical object that gives under a finger.
Purpose & UX principles
- Confirms that a touch registered even before the action completes.
- The effect must start immediately on press (under 50ms) and should be reversible, so the user can slide off to cancel.
- Keep the effect small. A scale of 0.96 to 0.98 is felt; 0.9 feels cartoonish except on tiny icon buttons.
Interaction states
- Rest, pressed (while pointer or finger is down), released (springs back).
- Cancelled: pointer leaves while pressed, so the element returns without triggering the action.
Motion specification
- Press in: 80ms ease-out, to scale 0.97.
- Release: 260ms cubic-bezier(0.34, 1.56, 0.64, 1) for a soft rebound.
- Reduced motion: darken only, no scale.
Responsive behaviour
- Apply to anything tappable: buttons, cards, list rows.
- Larger elements use a smaller scale (a full-width card: 0.99).
Code
<div class="col">
<button class="b">Button</button>
<button class="t">Tile</button>
<button class="r"><span>List row</span><span>›</span></button>
<p class="count">Completed taps: <b id="n">0</b></p>
</div>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
.col{display:grid;gap:14px;justify-items:center;width:min(320px,100%)}
button{font:inherit;color:var(--text);cursor:pointer;border:1px solid var(--line);background:var(--surface-2);-webkit-tap-highlight-color:transparent;touch-action:manipulation;transition:transform .26s cubic-bezier(.34,1.56,.64,1),background .26s}
button:active{background:#e4e4e1;transition:transform .08s ease-out,background .08s}
.b{height:44px;padding:0 28px;border-radius:12px}.b:active{transform:scale(.97)}
.t{width:120px;height:120px;border-radius:22px}.t:active{transform:scale(.96)}
.r{width:100%;height:56px;padding:0 18px;border-radius:14px;display:flex;justify-content:space-between;align-items:center}.r:active{transform:scale(.99)}
button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.count{color:var(--muted);font-size:14px}.count b{color:var(--accent)}
@media (prefers-reduced-motion:reduce){button,button:active{transition:none;transform:none!important}}const n=document.getElementById('n');let c=0;
document.querySelectorAll('button').forEach(b=>b.addEventListener('click',()=>{n.textContent=++c;}));One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Press Feedback — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
.col{display:grid;gap:14px;justify-items:center;width:min(320px,100%)}
button{font:inherit;color:var(--text);cursor:pointer;border:1px solid var(--line);background:var(--surface-2);-webkit-tap-highlight-color:transparent;touch-action:manipulation;transition:transform .26s cubic-bezier(.34,1.56,.64,1),background .26s}
button:active{background:#e4e4e1;transition:transform .08s ease-out,background .08s}
.b{height:44px;padding:0 28px;border-radius:12px}.b:active{transform:scale(.97)}
.t{width:120px;height:120px;border-radius:22px}.t:active{transform:scale(.96)}
.r{width:100%;height:56px;padding:0 18px;border-radius:14px;display:flex;justify-content:space-between;align-items:center}.r:active{transform:scale(.99)}
button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.count{color:var(--muted);font-size:14px}.count b{color:var(--accent)}
@media (prefers-reduced-motion:reduce){button,button:active{transition:none;transform:none!important}}
</style></head>
<body><div class="stage">
<div class="col">
<button class="b">Button</button>
<button class="t">Tile</button>
<button class="r"><span>List row</span><span>›</span></button>
<p class="count">Completed taps: <b id="n">0</b></p>
</div>
</div>
<script>
const n=document.getElementById('n');let c=0;
document.querySelectorAll('button').forEach(b=>b.addEventListener('click',()=>{n.textContent=++c;}));
</script>
</body></html>