Soft UI Raised & Pressed
Raised soft buttons and toggles that sink in when pressed, an inset field and a depth slider.
AI prompt
Design a soft UI (neumorphic) control set on a light warm-grey surface (#E8E8E4): a rounded 14 pixel raised button labelled "Play" with a light shadow at the top left (-6px -6px 12px white) and a darker shadow at the bottom right (6px 6px 12px rgba(0,0,0,0.12)), which changes to an inset shadow while pressed; a pill toggle that sinks in and shows a small accent dot when on; and an inset text field with the placeholder "Search". Add a "Depth" slider that scales all shadow distances from 2 to 12 pixels. Keep text near-black for contrast, add a 2 pixel focus outline, 150 millisecond shadow transitions and a prefers-reduced-motion fallback. Plain HTML and CSS with a little JavaScript for the slider and toggle.About this pattern
Definition
Soft UI (neumorphism) makes controls look moulded from the same material as the background. A light shadow on one side and a dark shadow on the other make an element look raised; swapping them to inset makes it look pressed in.
Purpose & UX principles
- Gives a calm, tactile look for dashboards, music players and smart-home controls.
- Contrast is low by nature: keep text dark, add icons or labels, and never rely on shadow alone to show state.
- Use sparingly; combine with clear focus outlines and a visible active colour for toggles.
Interaction states
- Raised (default), hover (slightly stronger), pressed (inset), focus-visible (outline), toggled on (inset plus accent dot).
Motion specification
- Shadows transition over 150ms ease; slider updates depth live.
- Reduced motion: instant change.
Responsive behaviour
- Reduce shadow distance on small screens so adjacent controls do not blur together.
- Keep touch targets at least 44px.
Code
<div class="bx" id="bx"><button class="sb" id="pl" type="button">▶ Play</button><button class="tg" id="tg" type="button" role="switch" aria-checked="false"><i></i><span>Shuffle</span></button><input class="fl" placeholder="Search" aria-label="Search"><label class="ctl">Depth <input id="dp" type="range" min="2" max="12" value="6"></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}
.bx{--d:6px;--blur:calc(var(--d) * 2);width:min(280px,100%);display:grid;gap:18px;padding:22px;border-radius:20px;background:#e8e8e4;justify-items:center}
.sb,.tg,.fl{border:0;background:#e8e8e4;color:#222;font-size:14px;font-weight:600;transition:box-shadow .15s ease}
.sb,.tg{box-shadow:calc(var(--d) * -1) calc(var(--d) * -1) var(--blur) #fff,var(--d) var(--d) var(--blur) rgba(0,0,0,.13)}
.sb{width:140px;height:46px;border-radius:14px;cursor:pointer}.sb:hover{box-shadow:calc(var(--d) * -1.3) calc(var(--d) * -1.3) calc(var(--blur) * 1.2) #fff,calc(var(--d) * 1.3) calc(var(--d) * 1.3) calc(var(--blur) * 1.2) rgba(0,0,0,.15)}
.sb:active,.tg[aria-checked=true]{box-shadow:inset calc(var(--d) * -1) calc(var(--d) * -1) var(--blur) #fff,inset var(--d) var(--d) var(--blur) rgba(0,0,0,.14)}
.tg{display:flex;align-items:center;gap:10px;height:42px;padding:0 20px 0 16px;border-radius:99px;cursor:pointer}
.tg i{width:10px;height:10px;border-radius:50%;background:#bdbdb8;transition:background .15s}.tg[aria-checked=true] i{background:#ff5a36}
.fl{width:100%;height:42px;border-radius:12px;padding:0 14px;font-weight:400;box-shadow:inset calc(var(--d) * -.8) calc(var(--d) * -.8) var(--blur) #fff,inset calc(var(--d) * .8) calc(var(--d) * .8) var(--blur) rgba(0,0,0,.12)}
.fl::placeholder{color:#6f6f6f}
.ctl{display:flex;gap:10px;align-items:center;font-size:12px;color:#555;width:100%}.ctl input{flex:1;accent-color:#171717}
button:focus-visible,input:focus-visible{outline:2px solid #171717;outline-offset:3px}
@media (prefers-reduced-motion:reduce){.sb,.tg,.fl,.tg i{transition:none}}const bx=document.getElementById('bx'),dp=document.getElementById('dp'),tg=document.getElementById('tg');
dp.addEventListener('input',()=>bx.style.setProperty('--d',dp.value+'px'));
tg.addEventListener('click',()=>tg.setAttribute('aria-checked',String(tg.getAttribute('aria-checked')!=='true')));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 UI Raised & Pressed — 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}}
.bx{--d:6px;--blur:calc(var(--d) * 2);width:min(280px,100%);display:grid;gap:18px;padding:22px;border-radius:20px;background:#e8e8e4;justify-items:center}
.sb,.tg,.fl{border:0;background:#e8e8e4;color:#222;font-size:14px;font-weight:600;transition:box-shadow .15s ease}
.sb,.tg{box-shadow:calc(var(--d) * -1) calc(var(--d) * -1) var(--blur) #fff,var(--d) var(--d) var(--blur) rgba(0,0,0,.13)}
.sb{width:140px;height:46px;border-radius:14px;cursor:pointer}.sb:hover{box-shadow:calc(var(--d) * -1.3) calc(var(--d) * -1.3) calc(var(--blur) * 1.2) #fff,calc(var(--d) * 1.3) calc(var(--d) * 1.3) calc(var(--blur) * 1.2) rgba(0,0,0,.15)}
.sb:active,.tg[aria-checked=true]{box-shadow:inset calc(var(--d) * -1) calc(var(--d) * -1) var(--blur) #fff,inset var(--d) var(--d) var(--blur) rgba(0,0,0,.14)}
.tg{display:flex;align-items:center;gap:10px;height:42px;padding:0 20px 0 16px;border-radius:99px;cursor:pointer}
.tg i{width:10px;height:10px;border-radius:50%;background:#bdbdb8;transition:background .15s}.tg[aria-checked=true] i{background:#ff5a36}
.fl{width:100%;height:42px;border-radius:12px;padding:0 14px;font-weight:400;box-shadow:inset calc(var(--d) * -.8) calc(var(--d) * -.8) var(--blur) #fff,inset calc(var(--d) * .8) calc(var(--d) * .8) var(--blur) rgba(0,0,0,.12)}
.fl::placeholder{color:#6f6f6f}
.ctl{display:flex;gap:10px;align-items:center;font-size:12px;color:#555;width:100%}.ctl input{flex:1;accent-color:#171717}
button:focus-visible,input:focus-visible{outline:2px solid #171717;outline-offset:3px}
@media (prefers-reduced-motion:reduce){.sb,.tg,.fl,.tg i{transition:none}}
</style></head>
<body><div class="stage">
<div class="bx" id="bx"><button class="sb" id="pl" type="button">▶ Play</button><button class="tg" id="tg" type="button" role="switch" aria-checked="false"><i></i><span>Shuffle</span></button><input class="fl" placeholder="Search" aria-label="Search"><label class="ctl">Depth <input id="dp" type="range" min="2" max="12" value="6"></label></div>
</div>
<script>
const bx=document.getElementById('bx'),dp=document.getElementById('dp'),tg=document.getElementById('tg');
dp.addEventListener('input',()=>bx.style.setProperty('--d',dp.value+'px'));
tg.addEventListener('click',()=>tg.setAttribute('aria-checked',String(tg.getAttribute('aria-checked')!=='true')));
</script>
</body></html>