Skip to content

Cosmic Portal Button

Hover opens a miniature galaxy inside the button with star particles and deep-space gradients

Cosmic Portal Button

by FreeCsStyles Dev's

AnimatedCosmic
🌐🎨⚛️💚🅰️🔥☁️
#cosmic#galaxy#portal#space#nebula#stars#magical

Embed this component

Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/cosmic-portal-button.

<iframe src="/embed/cosmic-portal-button" sandbox="allow-scripts" loading="lazy" title="Cosmic Portal Button" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>

Implementation code

Copy the HTML and CSS for Cosmic Portal 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="cosmic-btn">✦ PORTAL</button>
CSS
.cosmic-btn {
  position: relative;
  padding: 1.25rem 2.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #0a0015, #1a0030, #2d1b69, #0a0015);
  background-size: 400% 400%;
  color: #e0aaff;
  font-weight: 700;
  letter-spacing: 0.05em;
  border: 1px solid rgba(224,170,255,0.15);
  cursor: pointer;
  overflow: hidden;
  animation: cosmic-drift 8s linear infinite;
  transition: all 0.3s ease;
}
.cosmic-btn:hover { transform: scale(1.05); box-shadow: 0 0 40px rgba(224,170,255,0.25), 0 20px 50px rgba(0,0,0,0.5); border-color: rgba(224,170,255,0.3); }
.cosmic-btn:active { transform: scale(0.95); }
.cosmic-btn::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(224,170,255,0.06), transparent 60%);
  animation: cosmic-pulse 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes cosmic-drift { 0% { background-position: 0% 50%; } 100% { background-position: 100% 50%; } }
@keyframes cosmic-pulse { 0%,100% { transform: scale(1); opacity: 0.3; } 50% { transform: scale(1.1); opacity: 0.6; } }
Tailwind CSS
<button class="px-10 py-5 rounded-xl font-bold tracking-wider bg-gradient-to-br from-[#0a0015] via-[#1a0030] via-[#2d1b69] to-[#0a0015] bg-[length:400%_400%] text-fuchsia-200 border border-fuchsia-200/15 hover:scale-105 hover:shadow-[0_0_40px_rgba(224,170,255,0.25),0_20px_50px_rgba(0,0,0,0.5)] active:scale-95 transition-all overflow-hidden relative">
  <span class="relative z-10">✦ PORTAL</span>
</button>
React
function CosmicButton() {
  return (
    <motion.button
      className="px-10 py-5 rounded-xl font-bold tracking-wider relative overflow-hidden"
      style={{ background: 'linear-gradient(135deg, #0a0015, #1a0030, #2d1b69, #0a0015)', backgroundSize: '400% 400%', color: '#e0aaff', border: '1px solid rgba(224,170,255,0.15)', cursor: 'pointer' }}
      animate={{ backgroundPosition: ['0% 50%', '100% 50%', '0% 50%'] }}
      transition={{ backgroundPosition: { duration: 8, repeat: Infinity, ease: 'linear' } }}
      whileHover={{ scale: 1.05, boxShadow: '0 0 40px rgba(224,170,255,0.25), 0 20px 50px rgba(0,0,0,0.5)', borderColor: 'rgba(224,170,255,0.3)' }}
      whileTap={{ scale: 0.95 }}
    >
      <span style={{ position: 'relative', zIndex: 10 }}>✦ PORTAL</span>
      <motion.div style={{ position: 'absolute', inset: 0, background: 'radial-gradient(ellipse at 50% 50%, rgba(224,170,255,0.06), transparent 60%)' }}
        animate={{ scale: [1, 1.1, 1], opacity: [0.3, 0.6, 0.3] }}
        transition={{ duration: 6, repeat: Infinity, ease: 'easeInOut' }}
      />
    </motion.button>
  );
}
LWC — HTML template
<template><button class="cosmic-btn" onclick={handleClick}><span style="position:relative;z-index:10"><slot>✦ PORTAL</slot></span></button></template>
LWC — JavaScript
import { LightningElement, api } from 'lwc';
export default class CosmicButton extends LightningElement {
  @api label = '✦ PORTAL';
  handleClick() { this.dispatchEvent(new CustomEvent('buttonclick', { bubbles: true, composed: true })); }
}
LWC — CSS
.cosmic-btn { position: relative; padding: 1.25rem 2.5rem; border-radius: 0.75rem; background: linear-gradient(135deg, #0a0015, #1a0030, #2d1b69, #0a0015); background-size: 400% 400%; color: #e0aaff; font-weight: 700; letter-spacing: 0.05em; border: 1px solid rgba(224,170,255,0.15); cursor: pointer; overflow: hidden; animation: cosmic-drift 8s linear infinite; transition: all 0.3s ease; }
.cosmic-btn:hover { transform: scale(1.05); box-shadow: 0 0 40px rgba(224,170,255,0.25), 0 20px 50px rgba(0,0,0,0.5); border-color: rgba(224,170,255,0.3); }
.cosmic-btn:active { transform: scale(0.95); }
.cosmic-btn::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 50%, rgba(224,170,255,0.06), transparent 60%); animation: cosmic-pulse 6s ease-in-out infinite; pointer-events: none; }
@keyframes cosmic-drift { 0% { background-position: 0% 50%; } 100% { background-position: 100% 50%; } }
@keyframes cosmic-pulse { 0%,100% { transform: scale(1); opacity: 0.3; } 50% { transform: scale(1.1); opacity: 0.6; } }
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 Cosmic Portal Button fits

  • Gaming
  • Sci-Fi
  • AI
  • Creative Landing Pages
  • Fantasy

Interaction states & animations

  • Galaxy Swirl
  • Particle Orbit
  • Nebula Movement
  • Cosmic Glow

Topics

  • #cosmic
  • #galaxy
  • #portal
  • #space
  • #nebula
  • #stars
  • #magical

Accessibility notes

Avoid rapid flashing. Galaxy animation is decorative — no information conveyed through animation.

Browser support

  • All modern browsers