About
Glossy React icon buttons in white, mint, and primrose. A compact stack with custom icons, adjustable size and spacing, accessible native buttons, reduced-motion support, and embedded optimized materials.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Soft Keys to your project and fits it to your theme.
Code
How Soft Keys is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import * as React from "react";
import SoftKeys from "@/components/ui/soft-keys";
const settings = { size: 72, gap: 2 };
/** A clean listing preview: only the component on its pink background. */
export default function SoftKeysDemo({size=settings.size,gap=settings.gap}:Partial<typeof settings>={}) {
const [announcement,setAnnouncement]=React.useState("");
const count=React.useRef(0);
const stage=React.useRef<HTMLElement>(null);
const content=React.useRef<HTMLDivElement>(null);
const [scale,setScale]=React.useState(1);
React.useEffect(()=>{
const frame=stage.current;
const keys=content.current;
if(!frame || !keys) return;
const fit=()=>setScale(Math.max(0,Math.min(1,
(frame.clientWidth-48)/Math.max(1,keys.offsetWidth),
(frame.clientHeight-48)/Math.max(1,keys.offsetHeight)
)));
const observer=new ResizeObserver(fit);
observer.observe(frame);
observer.observe(keys);
fit();
return ()=>observer.disconnect();
},[]);
function activate(label:string) {
count.current+=1;
setAnnouncement(`${label} activated. ${count.current} presses.`);
}
return <section ref={stage} aria-label="Soft Keys demo" style={{
position:"fixed",inset:0,display:"grid",placeItems:"center",width:"100%",
gridTemplateRows:"minmax(0,1fr)",gridTemplateColumns:"minmax(0,1fr)",
height:"100dvh",boxSizing:"border-box",padding:24,overflow:"hidden",
background:"#ff5aab",color:"#351329"
}}>
<div ref={content} style={{transform:`scale(${scale})`,transformOrigin:"center"}}>
<SoftKeys aria-label="Quick actions" size={size} gap={gap} items={[
{id:"up",label:"Go up",icon:"up",color:"white",onClick:()=>activate("Go up")},
{id:"down",label:"Go down",icon:"down",color:"mint",onClick:()=>activate("Go down")},
{id:"help",label:"Get help",icon:"help",color:"primrose",onClick:()=>activate("Get help")},
{id:"contact",label:"Say hello",icon:"contact",color:"white",onClick:()=>activate("Say hello")},
]}/>
</div>
<span role="status" aria-live="polite" style={{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0}}>{announcement}</span>
</section>;
}









