3D Push Button
Tactile 3D button with press-down effect
Embed this component
Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/3d-push-button.
<iframe src="/embed/3d-push-button" sandbox="allow-scripts" loading="lazy" title="3D Push Button" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>Implementation code
Copy the HTML and CSS for 3D Push Button, or grab a framework-specific implementation. The HTML and CSS variants are self-contained; framework variants assume that framework's project setup.
HTML
<button class="push-button">Push Me</button>CSS
.push-button {
padding: 1rem 2rem;
border-radius: 0.75rem;
background: linear-gradient(to bottom, #a855f7, #7e22ce);
color: white;
font-weight: bold;
border: none;
cursor: pointer;
transition: all 0.1s ease;
box-shadow: 0 6px 0 #6b21a8, 0 8px 20px rgba(0, 0, 0, 0.3);
}
.push-button:hover {
background: linear-gradient(to bottom, #c084fc, #9333ea);
}
.push-button:active {
transform: translateY(6px);
box-shadow: 0 0 0 #6b21a8, 0 2px 10px rgba(0, 0, 0, 0.3);
}LWC — HTML template
<template>
<button class="push-button" onclick={handleClick}>
<slot>Push Me</slot>
</button>
</template>LWC — JavaScript
import { LightningElement, api } from 'lwc';
export default class PushButton extends LightningElement {
@api label = 'Push Me';
handleClick() {
this.dispatchEvent(new CustomEvent('buttonclick', {
bubbles: true,
composed: true
}));
}
}LWC — CSS
.push-button {
padding: 1rem 2rem;
border-radius: 0.75rem;
background: linear-gradient(to bottom, #a855f7, #7e22ce);
color: white;
font-weight: bold;
border: none;
cursor: pointer;
transition: all 0.1s ease;
box-shadow: 0 6px 0 #6b21a8, 0 8px 20px rgba(0, 0, 0, 0.3);
}
.push-button:hover {
background: linear-gradient(to bottom, #c084fc, #9333ea);
}
.push-button:active {
transform: translateY(6px);
box-shadow: 0 0 0 #6b21a8, 0 2px 10px rgba(0, 0, 0, 0.3);
}LWC — Configuration
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>Where 3D Push Button fits
- Gaming
- Playful UI
- Retro Apps
- Interactive Elements
Interaction states & animations
- Pressed
- Hover
Topics
- #3d
- #push
- #tactile
- #retro
- #gaming
- #depth
Accessibility notes
Ensure focus state is visible. Provide alternative for users with motor impairments.
Browser support
- All modern browsers