Lightning Charge
Click to charge up with vibrations and electric flashes, then unleash a fully powered glow
Embed this component
Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/lightning-charge-button.
<iframe src="/embed/lightning-charge-button" sandbox="allow-scripts" loading="lazy" title="Lightning Charge" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>Implementation code
Copy the HTML and CSS for Lightning Charge, 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="btn-lightning" id="lightBtn" onclick="triggerLightning()">
<span class="text">Power On</span>
</button>
<script>
function triggerLightning() {
const btn = document.getElementById('lightBtn');
if(btn.classList.contains('is-charging')) return;
btn.classList.add('is-charging');
btn.querySelector('.text').innerText = 'Charging...';
setTimeout(() => { btn.classList.remove('is-charging'); btn.classList.add('is-powered'); btn.querySelector('.text').innerText = 'Fully Powered!'; }, 2000);
setTimeout(() => { btn.classList.remove('is-powered'); btn.querySelector('.text').innerText = 'Power On'; }, 5500);
}
</script>CSS
.btn-lightning { width: 160px; height: 50px; border-radius: 12px; border: none; background: #475569; color: white; font-size: 16px; font-weight: 700; cursor: pointer; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; transition: all 0.3s ease; font-family: system-ui, sans-serif; }
.btn-lightning::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.8); opacity: 0; pointer-events: none; }
.btn-lightning.is-charging { animation: vibrate 0.1s infinite; background: #1e293b; color: #facc15; }
.btn-lightning.is-charging::before { animation: lightning-flash 0.3s infinite alternate; }
.btn-lightning.is-powered { background: #eab308; color: #000; box-shadow: 0 0 25px rgba(234,179,8,0.8); }
@keyframes vibrate { 0% { transform: translate(0,0); } 25% { transform: translate(-2px,2px); } 50% { transform: translate(2px,-2px); } 75% { transform: translate(-2px,-2px); } 100% { transform: translate(2px,2px); } }
@keyframes lightning-flash { 0% { opacity: 0; } 100% { opacity: 0.3; } }Tailwind CSS
<button class="w-[160px] h-[50px] rounded-xl border-none bg-slate-600 text-white text-base font-bold cursor-pointer relative flex items-center justify-center overflow-hidden transition-all duration-300 [&.is-charging]:animate-[vibrate_0.1s_infinite] [&.is-charging]:bg-slate-800 [&.is-charging]:text-yellow-400 [&.is-powered]:bg-yellow-500 [&.is-powered]:text-black [&.is-powered]:shadow-[0_0_25px_rgba(234,179,8,0.8)]" id="tw-light">
<span class="text">Power On</span>
</button>React
import React from 'react';
import { motion } from 'framer-motion';
function LightningChargeButton() {
const [state, setState] = React.useState('idle');
const handleClick = () => {
if (state !== 'idle') return;
setState('charging');
setTimeout(() => setState('powered'), 2000);
setTimeout(() => setState('idle'), 5500);
};
const ch = state === 'charging';
const p = state === 'powered';
return (
<motion.button onClick={handleClick}
style={{ width: 160, height: 50, borderRadius: 12, border: 'none', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 16, fontWeight: 700, position: 'relative', overflow: 'hidden', color: ch ? '#facc15' : p ? '#000' : '#fff', background: ch ? '#1e293b' : p ? '#eab308' : '#475569', boxShadow: p ? '0 0 25px rgba(234,179,8,0.8)' : 'none', transition: 'all 0.3s ease', fontFamily: 'system-ui, sans-serif' }}
animate={ch ? { x: [0, -2, 2, -2, 2, 0], transition: { duration: 0.1, repeat: Infinity } } : { x: 0 }}
whileTap={state === 'idle' ? { scale: 0.95 } : {}} disabled={state !== 'idle'}>
<motion.div style={{ position: 'absolute', inset: 0, background: 'rgba(255,255,255,0.8)', pointerEvents: 'none' }}
animate={ch ? { opacity: [0, 0.3, 0] } : { opacity: 0 }} transition={{ duration: 0.3, repeat: Infinity }} />
<span style={{ position: 'relative', zIndex: 2 }}>{ch ? 'Charging...' : p ? 'Fully Powered!' : 'Power On'}</span>
</motion.button>
);
}Vue
<template>
<button class="btn-lightning" :class="{ 'is-charging': state==='charging', 'is-powered': state==='powered' }" @click="handleClick" :disabled="state!=='idle'">
<span class="text">{{ state==='charging' ? 'Charging...' : state==='powered' ? 'Fully Powered!' : 'Power On' }}</span>
</button>
</template>
<script setup>
import { ref } from 'vue';
const state = ref('idle');
function handleClick() {
if (state.value !== 'idle') return;
state.value = 'charging';
setTimeout(() => state.value = 'powered', 2000);
setTimeout(() => state.value = 'idle', 5500);
}
</script>
<style scoped>
.btn-lightning { width: 160px; height: 50px; border-radius: 12px; border: none; background: #475569; color: white; font-size: 16px; font-weight: 700; cursor: pointer; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; transition: all 0.3s ease; }
.btn-lightning::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.8); opacity: 0; pointer-events: none; }
.btn-lightning.is-charging { animation: vibrate 0.1s infinite; background: #1e293b; color: #facc15; }
.btn-lightning.is-charging::before { animation: lightning-flash 0.3s infinite alternate; }
.btn-lightning.is-powered { background: #eab308; color: #000; box-shadow: 0 0 25px rgba(234,179,8,0.8); }
@keyframes vibrate { 0% { transform: translate(0,0); } 25% { transform: translate(-2px,2px); } 50% { transform: translate(2px,-2px); } 75% { transform: translate(-2px,-2px); } 100% { transform: translate(2px,2px); } }
@keyframes lightning-flash { 0% { opacity: 0; } 100% { opacity: 0.3; } }
</style>Svelte
<script>
let state = 'idle';
function handleClick() {
if (state !== 'idle') return;
state = 'charging';
setTimeout(() => state = 'powered', 2000);
setTimeout(() => state = 'idle', 5500);
}
</script>
<button class="btn-lightning" class:is-charging={state==='charging'} class:is-powered={state==='powered'} on:click={handleClick} disabled={state!=='idle'}>
<span>{state==='charging' ? 'Charging...' : state==='powered' ? 'Fully Powered!' : 'Power On'}</span>
</button>
<style>
.btn-lightning { width: 160px; height: 50px; border-radius: 12px; border: none; background: #475569; color: white; font-size: 16px; font-weight: 700; cursor: pointer; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; transition: all 0.3s ease; }
.btn-lightning::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.8); opacity: 0; pointer-events: none; }
.btn-lightning.is-charging { animation: vibrate 0.1s infinite; background: #1e293b; color: #facc15; }
.btn-lightning.is-charging::before { animation: lightning-flash 0.3s infinite alternate; }
.btn-lightning.is-powered { background: #eab308; color: #000; box-shadow: 0 0 25px rgba(234,179,8,0.8); }
@keyframes vibrate { 0% { transform: translate(0,0); } 25% { transform: translate(-2px,2px); } 50% { transform: translate(2px,-2px); } 75% { transform: translate(-2px,-2px); } 100% { transform: translate(2px,2px); } }
@keyframes lightning-flash { 0% { opacity: 0; } 100% { opacity: 0.3; } }
</style>Angular
import { Component } from '@angular/core';
@Component({
selector: 'app-lightning-charge-button',
template: `<button class="btn-lightning" [class.is-charging]="state==='charging'" [class.is-powered]="state==='powered'" (click)="handleClick()" [disabled]="state!=='idle'">
<span class="text">{{ state==='charging' ? 'Charging...' : state==='powered' ? 'Fully Powered!' : 'Power On' }}</span>
</button>`,
styles: [`.btn-lightning { width: 160px; height: 50px; border-radius: 12px; border: none; background: #475569; color: white; font-size: 16px; font-weight: 700; cursor: pointer; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; transition: all 0.3s ease; }
.btn-lightning::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.8); opacity: 0; pointer-events: none; }
.btn-lightning.is-charging { animation: vibrate 0.1s infinite; background: #1e293b; color: #facc15; }
.btn-lightning.is-charging::before { animation: lightning-flash 0.3s infinite alternate; }
.btn-lightning.is-powered { background: #eab308; color: #000; box-shadow: 0 0 25px rgba(234,179,8,0.8); }
@keyframes vibrate { 0% { transform: translate(0,0); } 25% { transform: translate(-2px,2px); } 50% { transform: translate(2px,-2px); } 75% { transform: translate(-2px,-2px); } 100% { transform: translate(2px,2px); } }
@keyframes lightning-flash { 0% { opacity: 0; } 100% { opacity: 0.3; } }`]
})
export class LightningChargeButtonComponent { state = 'idle'; handleClick() { if (this.state !== 'idle') return; this.state = 'charging'; setTimeout(() => this.state = 'powered', 2000); setTimeout(() => this.state = 'idle', 5500); } }LWC — HTML template
<template><button class="btn-lightning" onclick={handleClick} disabled={disabled}>
<span class="text">{label}</span>
</button></template>LWC — JavaScript
import { LightningElement } from 'lwc';
export default class LightningChargeButton extends LightningElement {
state = 'idle';
get disabled() { return this.state !== 'idle'; }
get label() { return this.state === 'charging' ? 'Charging...' : this.state === 'powered' ? 'Fully Powered!' : 'Power On'; }
handleClick() {
if (this.state !== 'idle') return;
this.state = 'charging';
const btn = this.template.querySelector('button');
btn.classList.add('is-charging');
setTimeout(() => { btn.classList.remove('is-charging'); btn.classList.add('is-powered'); this.state = 'powered'; }, 2000);
setTimeout(() => { btn.classList.remove('is-powered'); this.state = 'idle'; }, 5500);
}
}LWC — CSS
.btn-lightning { width: 160px; height: 50px; border-radius: 12px; border: none; background: #475569; color: white; font-size: 16px; font-weight: 700; cursor: pointer; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; transition: all 0.3s ease; }
.btn-lightning::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.8); opacity: 0; pointer-events: none; }
.btn-lightning.is-charging { animation: vibrate 0.1s infinite; background: #1e293b; color: #facc15; }
.btn-lightning.is-charging::before { animation: lightning-flash 0.3s infinite alternate; }
.btn-lightning.is-powered { background: #eab308; color: #000; box-shadow: 0 0 25px rgba(234,179,8,0.8); }
@keyframes vibrate { 0% { transform: translate(0,0); } 25% { transform: translate(-2px,2px); } 50% { transform: translate(2px,-2px); } 75% { transform: translate(-2px,-2px); } 100% { transform: translate(2px,2px); } }
@keyframes lightning-flash { 0% { opacity: 0; } 100% { opacity: 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 Lightning Charge fits
- Power Up
- Energize
- Activate
- Boost
- Load Complete
Interaction states & animations
- Vibrate
- Flash
- Charge Up
- Glow Release
Topics
- #lightning
- #charge
- #power
- #vibrate
- #electric
- #flash
- #energy
Accessibility notes
Vibration animation may be disorienting — respect prefers-reduced-motion. Announce state changes.
Browser support
- All modern browsers