Balloon Delivery
Click to inflate a balloon that carries a message upward, floating away with floating hearts
Embed this component
Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/balloon-delivery-button.
<iframe src="/embed/balloon-delivery-button" sandbox="allow-scripts" loading="lazy" title="Balloon Delivery" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>Implementation code
Copy the HTML and CSS for Balloon Delivery, 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-balloon" id="balloonBtn" onclick="triggerBalloon()" style="display:inline-flex;align-items:center;justify-content:center;gap:10px">
<span class="balloon-group" style="position:relative;display:inline-flex;align-items:center">
<span class="balloon-wrap" style="position:absolute;right:100%;top:50%;transform:translateY(-50%);display:flex">
<span class="balloon" style="font-size:22px;line-height:1;transform:scale(0);opacity:0;transition:transform .35s cubic-bezier(.4,0,.2,1),opacity .35s">🎈</span>
</span>
<span class="message" style="font-size:14px;line-height:1">✉️</span>
</span>
<span class="text" style="font-size:16px;font-weight:700">Share</span>
</button>
<script>
function triggerBalloon(){const btn=document.getElementById('balloonBtn');if(btn.classList.contains('is-inflating'))return;const balloon=btn.querySelector('.balloon');btn.classList.add('is-inflating');balloon.style.transform='scale(1)';balloon.style.opacity='1';setTimeout(()=>{btn.classList.add('is-floating');const hx=[-22,-14,4,-26];const hy=[-6,8,-4,2];hx.forEach((x,i)=>{const h=document.createElement('span');h.innerText='❤️';h.classList.add('heart');h.style.left=x+'px';h.style.bottom='auto';h.style.top=(hy[i]+8)+'px';h.style.animationDelay=(i*0.15+0.2)+'s';h.style.animation='floatHeart 1s ease-out forwards';btn.querySelector('.balloon-group').appendChild(h);});},800);setTimeout(()=>{btn.classList.remove('is-inflating','is-floating');balloon.style.transform='scale(0)';balloon.style.opacity='0';btn.querySelectorAll('.heart').forEach(h=>h.remove());},4000);}
</script>CSS
.btn-balloon{width:160px;height:50px;border-radius:12px;border:none;background:#db2777;color:#fff;font-size:16px;font-weight:700;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:10px;overflow:visible;font-family:system-ui,sans-serif}.btn-balloon .balloon-group{position:relative;display:inline-flex;align-items:center}.btn-balloon .balloon{font-size:22px;line-height:1;transform:scale(0);opacity:0;transition:transform .35s cubic-bezier(.4,0,.2,1),opacity .35s}.btn-balloon .heart{position:absolute;font-size:12px;opacity:0;pointer-events:none}.btn-balloon.is-inflating .balloon{transform:scale(1)!important;opacity:1!important}.btn-balloon.is-floating .balloon-group{transform:translateY(-150px) rotate(15deg)}@keyframes floatHeart{0%{transform:translateY(0) scale(.5);opacity:1}100%{transform:translateY(-28px) scale(1.2);opacity:0}}Tailwind CSS
<button class="w-[160px] h-[50px] rounded-xl border-none bg-pink-600 text-white text-base font-bold cursor-pointer inline-flex items-center justify-center gap-2.5 overflow-visible [&.is-inflating_.balloon]:scale-100 [&.is-inflating_.balloon]:opacity-100 [&.is-floating_.balloon-group]:-translate-y-[150px] [&.is-floating_.balloon-group]:rotate-[15deg]" id="tw-balloon">
<span class="balloon-group relative inline-flex items-center">
<span class="absolute right-full top-1/2 -translate-y-1/2 flex">
<span class="balloon text-[22px] leading-none scale-0 opacity-0 transition-all duration-[350ms] ease-[cubic-bezier(.4,0,.2,1)]">🎈</span>
</span>
<span class="message text-sm leading-none">✉️</span>
</span>
<span class="text text-base font-bold">Share</span>
</button>React
import React from 'react';
import { motion } from 'framer-motion';
function BalloonDeliveryButton() {
const [state, setState] = React.useState('idle');
const handleClick = () => {
if (state !== 'idle') return;
setState('inflating');
setTimeout(() => setState('floating'), 800);
setTimeout(() => setState('idle'), 4000);
};
const inf = state==='inflating';
const flt = state==='floating';
const hearts = flt ? [{x:-22,y:-6,d:0},{x:-14,y:8,d:.2},{x:4,y:-4,d:.35},{x:-26,y:2,d:.5}] : [];
return (
<motion.button onClick={handleClick}
style={{ width: 160, height: 50, borderRadius: 12, border: 'none', cursor: state!=='idle'?'default':'pointer', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 10, position: 'relative', fontSize: 16, fontWeight: 700, color: '#fff', background: '#db2777', overflow: 'visible', fontFamily: 'system-ui, sans-serif' }}
whileTap={state === 'idle' ? { scale: 0.95 } : {}} disabled={state !== 'idle'}>
<motion.span style={{ position: 'relative', display: 'inline-flex', alignItems: 'center' }}
animate={flt ? { y: -150, rotate: 15, transition: { duration: 2, ease: 'easeIn' } } : { y: 0, rotate: 0 }}>
<span style={{ position: 'absolute', right: '100%', top: '50%', transform: 'translateY(-50%)', display: 'flex' }}>
<motion.span style={{ fontSize: 22, lineHeight: 1 }}
animate={inf||flt ? { scale: 1, opacity: 1, transition: { duration: 0.35, ease: [0.4,0,0.2,1] } } : { scale: 0, opacity: 0 }}>🎈</motion.span>
</span>
<span style={{ fontSize: 14, lineHeight: 1 }}>✉️</span>
{hearts.map((h,i)=>(
<motion.span key={i} style={{ position: 'absolute', fontSize: 12, pointerEvents: 'none', left: h.x }}
initial={{ y: h.y+8, scale: 0.5, opacity: 1 }}
animate={{ y: h.y-20, scale: 1.2, opacity: 0 }}
transition={{ duration: 1, ease: 'easeOut', delay: h.d }}>❤️</motion.span>
))}
</motion.span>
<motion.span animate={state!=='idle' ? { opacity: 0, width: 0, margin: 0, overflow: 'hidden' } : {}} style={{ fontSize: 16, fontWeight: 700 }}>Share</motion.span>
</motion.button>
);
}Vue
<template>
<button class="btn-balloon" :class="{'is-inflating':state==='inflating','is-floating':state==='floating'}" @click="handleClick" :disabled="state!=='idle'" style="display:inline-flex;align-items:center;justify-content:center;gap:10px">
<span class="balloon-group" style="position:relative;display:inline-flex;align-items:center">
<span class="balloon-wrap" style="position:absolute;right:100%;top:50%;transform:translateY(-50%);display:flex">
<span class="balloon" style="font-size:22px;line-height:1;transform:scale(0);opacity:0;transition:transform .35s cubic-bezier(.4,0,.2,1),opacity .35s">🎈</span>
</span>
<span class="message" style="font-size:14px;line-height:1">✉️</span>
</span>
<span class="text" style="font-size:16px;font-weight:700">Share</span>
</button>
</template>
<script setup>
import { ref } from 'vue';
const state = ref('idle');
function handleClick() {
if (state.value !== 'idle') return;
state.value = 'inflating';
setTimeout(() => state.value = 'floating', 800);
setTimeout(() => state.value = 'idle', 4000);
}
</script>
<style scoped>
.btn-balloon{width:160px;height:50px;border-radius:12px;border:none;background:#db2777;color:#fff;font-size:16px;font-weight:700;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:10px;overflow:visible;font-family:system-ui,sans-serif}.btn-balloon .balloon-group{position:relative;display:inline-flex;align-items:center}.btn-balloon .balloon{font-size:22px;line-height:1;transform:scale(0);opacity:0;transition:transform .35s cubic-bezier(.4,0,.2,1),opacity .35s}.btn-balloon .heart{position:absolute;font-size:12px;opacity:0;pointer-events:none}.btn-balloon.is-inflating .balloon{transform:scale(1)!important;opacity:1!important}.btn-balloon.is-floating .balloon-group{transform:translateY(-150px) rotate(15deg)}@keyframes floatHeart{0%{transform:translateY(0) scale(.5);opacity:1}100%{transform:translateY(-28px) scale(1.2);opacity:0}}
</style>Svelte
<script>
let state = 'idle';
function handleClick() {
if (state !== 'idle') return;
state = 'inflating';
setTimeout(() => state = 'floating', 800);
setTimeout(() => state = 'idle', 4000);
}
</script>
<button class="btn-balloon" class:is-inflating={state==='inflating'} class:is-floating={state==='floating'} on:click={handleClick} disabled={state!=='idle'}>
<span class="balloon-group" style="position:relative;display:inline-flex;align-items:center">
<span class="balloon-wrap" style="position:absolute;right:100%;top:50%;transform:translateY(-50%);display:flex">
<span class="balloon" style="font-size:22px;line-height:1;transform:scale(0);opacity:0;transition:transform .35s cubic-bezier(.4,0,.2,1),opacity .35s">🎈</span>
</span>
<span class="message" style="font-size:14px;line-height:1">✉️</span>
</span>
<span class="text" style="font-size:16px;font-weight:700">Share</span>
</button>
<style>
.btn-balloon{width:160px;height:50px;border-radius:12px;border:none;background:#db2777;color:#fff;font-size:16px;font-weight:700;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:10px;overflow:visible;font-family:system-ui,sans-serif}.btn-balloon .balloon-group{position:relative;display:inline-flex;align-items:center}.btn-balloon .balloon{font-size:22px;line-height:1;transform:scale(0);opacity:0;transition:transform .35s cubic-bezier(.4,0,.2,1),opacity .35s}.btn-balloon .heart{position:absolute;font-size:12px;opacity:0;pointer-events:none}.btn-balloon.is-inflating .balloon{transform:scale(1)!important;opacity:1!important}.btn-balloon.is-floating .balloon-group{transform:translateY(-150px) rotate(15deg)}@keyframes floatHeart{0%{transform:translateY(0) scale(.5);opacity:1}100%{transform:translateY(-28px) scale(1.2);opacity:0}}
</style>Angular
import { Component } from '@angular/core';
@Component({
selector: 'app-balloon-delivery-button',
template: `<button class="btn-balloon" [class.is-inflating]="state==='inflating'" [class.is-floating]="state==='floating'" (click)="handleClick()" [disabled]="state!=='idle'">
<span class="balloon-group" style="position:relative;display:inline-flex;align-items:center">
<span class="balloon-wrap" style="position:absolute;right:100%;top:50%;transform:translateY(-50%);display:flex">
<span class="balloon" style="font-size:22px;line-height:1;transform:scale(0);opacity:0;transition:transform .35s cubic-bezier(.4,0,.2,1),opacity .35s">🎈</span>
</span>
<span class="message" style="font-size:14px;line-height:1">✉️</span>
</span>
<span class="text" style="font-size:16px;font-weight:700">Share</span>
</button>`,
styles: [`.btn-balloon{width:160px;height:50px;border-radius:12px;border:none;background:#db2777;color:#fff;font-size:16px;font-weight:700;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:10px;overflow:visible;font-family:system-ui,sans-serif}.btn-balloon .balloon-group{position:relative;display:inline-flex;align-items:center}.btn-balloon .balloon{font-size:22px;line-height:1;transform:scale(0);opacity:0;transition:transform .35s cubic-bezier(.4,0,.2,1),opacity .35s}.btn-balloon .heart{position:absolute;font-size:12px;opacity:0;pointer-events:none}.btn-balloon.is-inflating .balloon{transform:scale(1)!important;opacity:1!important}.btn-balloon.is-floating .balloon-group{transform:translateY(-150px) rotate(15deg)}@keyframes floatHeart{0%{transform:translateY(0) scale(.5);opacity:1}100%{transform:translateY(-28px) scale(1.2);opacity:0}}`]
})
export class BalloonDeliveryButtonComponent { state='idle';handleClick(){if(this.state!=='idle')return;this.state='inflating';setTimeout(()=>this.state='floating',800);setTimeout(()=>this.state='idle',4000);}}LWC — HTML template
<template><button class="btn-balloon" onclick={handleClick} disabled={disabled} style="display:inline-flex;align-items:center;justify-content:center;gap:10px">
<span class="balloon-group" style="position:relative;display:inline-flex;align-items:center">
<span class="balloon-wrap" style="position:absolute;right:100%;top:50%;transform:translateY(-50%);display:flex">
<span class="balloon" style="font-size:22px;line-height:1;transform:scale(0);opacity:0;transition:transform .35s cubic-bezier(.4,0,.2,1),opacity .35s">🎈</span>
</span>
<span class="message" style="font-size:14px;line-height:1">✉️</span>
</span>
<span class="text" style="font-size:16px;font-weight:700">Share</span>
</button></template>LWC — JavaScript
import { LightningElement } from 'lwc';
export default class BalloonDeliveryButton extends LightningElement {
state = 'idle';
get disabled() { return this.state !== 'idle'; }
handleClick() {
if (this.state !== 'idle') return;
this.state = 'inflating';
const btn = this.template.querySelector('button');
btn.classList.add('is-inflating');
setTimeout(() => { btn.classList.add('is-floating'); const hx=[-22,-14,4,-26];const hy=[-6,8,-4,2];hx.forEach((x,i)=>{const h=document.createElement('span');h.innerText='❤️';h.classList.add('heart');h.style.left=x+'px';h.style.bottom='auto';h.style.top=(hy[i]+8)+'px';h.style.animationDelay=(i*0.15+0.2)+'s';btn.querySelector('.balloon-group').appendChild(h);}); this.state = 'floating'; }, 800);
setTimeout(() => { btn.classList.remove('is-inflating','is-floating'); btn.querySelectorAll('.heart').forEach(h=>h.remove()); this.state = 'idle'; }, 4000);
}
}LWC — CSS
.btn-balloon{width:160px;height:50px;border-radius:12px;border:none;background:#db2777;color:#fff;font-size:16px;font-weight:700;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:10px;overflow:visible;font-family:system-ui,sans-serif}.btn-balloon .balloon-group{position:relative;display:inline-flex;align-items:center}.btn-balloon .balloon{font-size:22px;line-height:1;transform:scale(0);opacity:0;transition:transform .35s cubic-bezier(.4,0,.2,1),opacity .35s}.btn-balloon .heart{position:absolute;font-size:12px;opacity:0;pointer-events:none}.btn-balloon.is-inflating .balloon{transform:scale(1)!important;opacity:1!important}.btn-balloon.is-floating .balloon-group{transform:translateY(-150px) rotate(15deg)}@keyframes floatHeart{0%{transform:translateY(0) scale(.5);opacity:1}100%{transform:translateY(-28px) scale(1.2);opacity:0}}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 Balloon Delivery fits
- Share
- Celebrate
- Wish
- Send Love
- Announce
Interaction states & animations
- Inflate
- Float Away
- Heart Float
- Rise
Topics
- #balloon
- #float
- #heart
- #message
- #celebrate
- #rise
- #inflate
Accessibility notes
Balloon and hearts are decorative. Announce state changes via aria-live.
Browser support
- All modern browsers