Backgrounds
Dotted Glow Background
Animated dotted background with glowing effects and customizable colors.
The DottedGlowBackground component creates an animated dotted background with glowing effects and customizable colors. It's perfect for creating visually appealing backgrounds with subtle animations.
Usage
Welcome to Nuxt UI
<template>
<UContainer class="min-h-screen relative">
<MDottedGlowBackground
:gap="16"
:radius="2"
color-light-var="--color-gray-900"
color-dark-var="--color-gray-100"
glow-color-light-var="--color-primary-500"
glow-color-dark-var="--color-primary-400"
class="background"
/>
<div class="relative z-10 py-12">
<UCard class="max-w-2xl mx-auto backdrop-blur-sm bg-default/80">
<template #header>
<div class="flex items-center justify-between">
<h1 class="text-2xl font-bold text-highlighted">
Welcome to Nuxt UI
</h1>
<UColorModeButton />
</div>
</template>
</UCard>
</div>
</UContainer>
</template>
The
colorLightVar, colorDarkVar, glowColorLightVar and glowColorDarkVar
props take a CSS variable name without needing to resolve it yourself. Drop in
a Nuxt UI token (--ui-primary, --ui-text-muted) or a palette variable
(--color-primary-400) and the component converts it to the concrete colour the
browser paints — so the dots and glow track your brand across light and dark
mode.Examples
Basic Dotted Glow Background
Dotted Glow
Subtle glowing dot patterns that create depth and visual interest in your backgrounds
<template>
<div class="relative h-80 rounded-xl overflow-hidden border border-default">
<MDottedGlowBackground
:gap="15"
:radius="2"
class="background absolute inset-0"
/>
<div class="relative z-10 h-full flex flex-col items-center justify-center text-center p-6">
<div class="mb-6">
<div class="w-16 h-16 rounded-full bg-gradient-to-r from-blue-400 to-purple-500 flex items-center justify-center mx-auto">
<UIcon
name="i-lucide-sparkles"
class="w-8 h-8 text-white"
/>
</div>
</div>
<h2 class="text-3xl font-bold text-highlighted mb-4">
Dotted Glow
</h2>
<p class="text-default max-w-md mb-6">
Subtle glowing dot patterns that create depth and visual interest in your backgrounds
</p>
<UButton
color="primary"
variant="solid"
size="md"
>
Customize Pattern
</UButton>
</div>
</div>
</template>
Customize
Customize
Gap12
Radius2
Color
Dark Color
Glow Color
Dark Glow Color
Color Light Var
Color Dark Var
Glow Color Light Var
Glow Color Dark Var
Opacity0.6
Background Opacity0
Speed Min0.4
Speed Max1.3
Speed Scale1
Props
| Prop | Type | Default | Description |
|---|---|---|---|
class | string | '' | CSS classes to apply to the container. |
style | object | {} | Inline styles to apply to the container. |
gap | number | 12 | Gap between dots in pixels. |
radius | number | 2 | Radius of each dot in pixels. |
color | string | 'rgba(0,0,0,0.7)' | Color of the dots in light mode. |
darkColor | string | undefined | Color of the dots in dark mode. |
glowColor | string | 'rgba(0, 170, 255, 0.85)' | Glow color of the dots in light mode. |
darkGlowColor | string | undefined | Glow color of the dots in dark mode. |
colorLightVar | string | undefined | CSS variable for dot color in light mode. Pass a Nuxt UI token variable
(--ui-text-muted) or a palette variable (--color-gray-900); it is resolved
to a concrete colour against the container, so it follows the theme. |
colorDarkVar | string | undefined | CSS variable for dot color in dark mode, resolved the same way. |
glowColorLightVar | string | undefined | CSS variable for glow color in light mode. Pass a token such as --ui-primary
and it resolves through the theme automatically. |
glowColorDarkVar | string | undefined | CSS variable for glow color in dark mode, resolved the same way. |
opacity | number | 0.6 | Opacity of the dots (0-1). |
backgroundOpacity | number | 0 | Opacity of the background gradient (0-1). |
speedMin | number | 0.4 | Minimum animation speed. |
speedMax | number | 1.3 | Maximum animation speed. |
speedScale | number | 1 | Scale factor for animation speed. |
UI
This component's theme exposes the slots below. Override any of them per instance with the ui prop, or app-wide under ui.dottedGlowBackground in app.config.ts.
| Prop | Type | Default | Description |
|---|---|---|---|
ui | object | - | Per-slot classes merged over the theme defaults. |
| Slot | Props | Description |
|---|---|---|
root | - | |
canvas | - |