1 estrella en GitHub = 1 componente nuevo.

Dar una estrella
Navegación burgericonanimated

Animated Burger Menu

Icono de hamburguesa con animación de metamorfosis hacia una X de cierre al activarse.

Vista Previa en Vivo

Uso

Copia y pega este código directamente en tu página de Astro:

astro
---
import { AnimatedBurgerMenu } from 'astro-component-kit';
---

<BurgerMorphIcon>Content</BurgerMorphIcon>
--- import { AnimatedBurgerMenu } from 'astro-component-kit'; --- <BurgerMorphIcon>Content</BurgerMorphIcon>

Instalación Manual

Si no estás usando el paquete npm, crea un archivo nuevo y pega el siguiente código: src/components/lib/AnimatedBurgerMenu.astro:

astro
---
---
<button class="burger" onclick="this.classList.toggle('active')">
  <span></span><span></span><span></span>
</button>
<style>
  .burger { background: none; border: none; width: 30px; height: 24px; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; }
  .burger span { width: 100%; height: 3px; background: #fff; border-radius: 2px; transition: 0.4s; }
  .burger.active span:nth-child(1) { transform: translateY(10.5px) rotate(45deg); }
  .burger.active span:nth-child(2) { opacity: 0; }
  .burger.active span:nth-child(3) { transform: translateY(-10.5px) rotate(-45deg); }
</style>
--- --- <button class="burger" onclick="this.classList.toggle('active')"> <span></span><span></span><span></span> </button> <style> .burger { background: none; border: none; width: 30px; height: 24px; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; } .burger span { width: 100%; height: 3px; background: #fff; border-radius: 2px; transition: 0.4s; } .burger.active span:nth-child(1) { transform: translateY(10.5px) rotate(45deg); } .burger.active span:nth-child(2) { opacity: 0; } .burger.active span:nth-child(3) { transform: translateY(-10.5px) rotate(-45deg); } </style>

Información Rápida

Categoría
Navegación
Nombre de archivo
AnimatedBurgerMenu.astro
Dependencias
Ninguna — Astro nativo + CSS puro
Etiquetas
burgericonanimated