Hexagon Background

A background component featuring an interactive hexagon grid.

<script setup lang="ts">
import HexagonBackground from '@/components/animate-ui/backgrounds/hexagon/HexagonBackground.vue'
</script>

<template>
  <HexagonBackground class="absolute inset-0" />
</template>

Installation

npx shadcn-vue@latest add https://animate-ui.com/r/vue/backgrounds-hexagon.json
pnpm dlx shadcn-vue@latest add https://animate-ui.com/r/vue/backgrounds-hexagon.json
yarn dlx shadcn-vue@latest add https://animate-ui.com/r/vue/backgrounds-hexagon.json
bun x shadcn-vue@latest add https://animate-ui.com/r/vue/backgrounds-hexagon.json

Usage

<script setup lang="ts">
import HexagonBackground from '@/components/animate-ui/backgrounds/hexagon/HexagonBackground.vue';
</script>

<template>
  <section class="relative h-[480px] overflow-hidden">
    <HexagonBackground class="absolute inset-0" />
  </section>
</template>

Animation

  • A grid of hexagons that fills its container and recounts its cells when the container resizes.
  • A hovered hexagon lights up instantly, and fades back over 1s when the pointer leaves, leaving a trail. Hover only applies to devices that can hover, so a tap doesn't leave a cell lit.
  • Nothing loops, so there is nothing to pause.
  • Reduced motion keeps the fade: it's a color change, not movement.

API Reference

HexagonBackground

PropTypeDefault
hexagon-size?
number75
hexagon-margin?
number3
hexagon-props?
HTMLAttributes-
...attrs?
HTMLAttributes-

Credits

Built by Skyleen. The source code is available on GitHub.

Last updated: 10/23/2026