Soft Rubber Squish
A soft silicone button that squashes when pressed, with a hardness slider for how far it gives.
AI prompt
Studio product photograph of a soft matte silicone button in mint green pressed gently so it flattens slightly and bulges at the sides, a faint highlight along the top edge, darker inner shadow at the base, soft gradient background, matte surface with no glare, 85mm lens, tactile and friendly. Variants: peach, charcoal and lilac. Negative: glossy plastic, chrome, cracks, text, hand in frame, hard shadows. Reduced motion: show only a slight darkening on press.About this pattern
Definition
Soft materials deform when pressed: they get shorter and wider, then spring back with a small overshoot. A matte surface with a soft highlight plus a squash scale on press is enough to make a flat shape feel like rubber.
When to use it
- Squash and stretch: reduce height, increase width by a smaller amount, then release with a springy curve.
- Keep the surface matte: a faint top highlight and a darker inner edge, no sharp glare.
- Use real button elements so keyboard Space and Enter produce the same squash.
What the controls do
- Four colours, a Hardness slider and a big press button.
Motion & timing
- Press: 90ms squash. Release: 420ms spring with overshoot.
- Reduced motion: the squash is replaced by a brief colour darkening, no scale.
Tips & variations
- Respect a larger tap target; the squash must not move the hit area away from the finger.
- Limit the squash to about 10 to 30 percent.
Code of this live preview
<div class="bx"><div class="sc"><button class="rb" id="rb" type="button" aria-label="Press"><span>Press me</span></button></div><div class="pre" id="pre" role="group" aria-label="Colour"><button data-p="0" aria-pressed="true">Mint</button><button data-p="1" aria-pressed="false">Peach</button><button data-p="2" aria-pressed="false">Charcoal</button><button data-p="3" aria-pressed="false">Lilac</button></div><label class="rw">Hardness <b id="hv">50%</b><input id="hd" type="range" min="0" max="100" value="50"></label></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}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sc{height:132px;display:grid;place-items:center;border-radius:12px;background:linear-gradient(#efefec,#e1e1dd)}
.rb{width:170px;height:78px;border-radius:40px;border:0;color:var(--tx);font-weight:700;font-size:15px;background:radial-gradient(120% 90% at 50% 0%,rgba(255,255,255,.35),transparent 60%),var(--b);box-shadow:0 10px 0 var(--d),0 16px 18px rgba(0,0,0,.2),inset 0 -6px 12px rgba(0,0,0,.14);transition:transform .42s cubic-bezier(.3,1.7,.5,1),box-shadow .42s cubic-bezier(.3,1.7,.5,1)}
.rb:active{transform:translateY(6px) scale(var(--sx),var(--sy));box-shadow:0 4px 0 var(--d),0 8px 12px rgba(0,0,0,.2),inset 0 -4px 10px rgba(0,0,0,.18);transition-duration:.09s}
@media (prefers-reduced-motion:reduce){.rb:active{transform:none;filter:brightness(.9)}}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}const R=[['#9ad8c0','#6fb59b','#17483a'],['#f3b49a','#cf8a6c','#5a2a18'],['#3b3d43','#25272b','#f2f2f2'],['#c9b8ea','#a590cf','#2e2150']],rb=document.getElementById('rb'),hd=document.getElementById('hd'),bs=[...document.querySelectorAll('#pre button')];let p=0;
function up(){const s=1-hd.value/100;rb.style.setProperty('--b',R[p][0]);rb.style.setProperty('--d',R[p][1]);rb.style.setProperty('--tx',R[p][2]);rb.style.setProperty('--sx',(1+s*.22).toFixed(3));rb.style.setProperty('--sy',(1-s*.3).toFixed(3));document.getElementById('hv').textContent=hd.value+'%';bs.forEach(b=>b.setAttribute('aria-pressed',String(+b.dataset.p===p)));}
bs.forEach(b=>b.addEventListener('click',()=>{p=+b.dataset.p;up();}));hd.addEventListener('input',up);up();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>Soft Rubber Squish — 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}}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sc{height:132px;display:grid;place-items:center;border-radius:12px;background:linear-gradient(#efefec,#e1e1dd)}
.rb{width:170px;height:78px;border-radius:40px;border:0;color:var(--tx);font-weight:700;font-size:15px;background:radial-gradient(120% 90% at 50% 0%,rgba(255,255,255,.35),transparent 60%),var(--b);box-shadow:0 10px 0 var(--d),0 16px 18px rgba(0,0,0,.2),inset 0 -6px 12px rgba(0,0,0,.14);transition:transform .42s cubic-bezier(.3,1.7,.5,1),box-shadow .42s cubic-bezier(.3,1.7,.5,1)}
.rb:active{transform:translateY(6px) scale(var(--sx),var(--sy));box-shadow:0 4px 0 var(--d),0 8px 12px rgba(0,0,0,.2),inset 0 -4px 10px rgba(0,0,0,.18);transition-duration:.09s}
@media (prefers-reduced-motion:reduce){.rb:active{transform:none;filter:brightness(.9)}}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
</style></head>
<body><div class="stage">
<div class="bx"><div class="sc"><button class="rb" id="rb" type="button" aria-label="Press"><span>Press me</span></button></div><div class="pre" id="pre" role="group" aria-label="Colour"><button data-p="0" aria-pressed="true">Mint</button><button data-p="1" aria-pressed="false">Peach</button><button data-p="2" aria-pressed="false">Charcoal</button><button data-p="3" aria-pressed="false">Lilac</button></div><label class="rw">Hardness <b id="hv">50%</b><input id="hd" type="range" min="0" max="100" value="50"></label></div>
</div>
<script>
const R=[['#9ad8c0','#6fb59b','#17483a'],['#f3b49a','#cf8a6c','#5a2a18'],['#3b3d43','#25272b','#f2f2f2'],['#c9b8ea','#a590cf','#2e2150']],rb=document.getElementById('rb'),hd=document.getElementById('hd'),bs=[...document.querySelectorAll('#pre button')];let p=0;
function up(){const s=1-hd.value/100;rb.style.setProperty('--b',R[p][0]);rb.style.setProperty('--d',R[p][1]);rb.style.setProperty('--tx',R[p][2]);rb.style.setProperty('--sx',(1+s*.22).toFixed(3));rb.style.setProperty('--sy',(1-s*.3).toFixed(3));document.getElementById('hv').textContent=hd.value+'%';bs.forEach(b=>b.setAttribute('aria-pressed',String(+b.dataset.p===p)));}
bs.forEach(b=>b.addEventListener('click',()=>{p=+b.dataset.p;up();}));hd.addEventListener('input',up);up();
</script>
</body></html>