# Aurora Background

Soft glowing color fields that drift slowly behind your content, made from primary and an accent token.

- Category: Backgrounds
- Status: stable
- Registry: https://markas.jenderalcorp.com/r/aurora-background.json
- CLI: `npx markasui@latest add aurora-background`

## When to use

A calm, colorful backdrop for a landing hero, pricing CTA, or sign-in screen.

- Set the background color, padding, and radius with class on the component
- Use one aurora per view; it is meant as the main backdrop
- Use speed=slow behind long text so the motion does not distract

## Code

### Blade

Save at `resources/views/components/markas/aurora-background.blade.php`. No extra dependencies.

```blade
@props([
    'color' => 'success',
    'speed' => 'normal',
])

@php
    $base = 'relative isolate overflow-hidden';
    $layer = 'pointer-events-none absolute inset-0 overflow-hidden';
    $glowA = 'absolute -inset-1/2 animate-[markas-aurora-a_var(--markas-aurora-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(30%_34%_at_36%_44%,color-mix(in_oklab,var(--markas-aurora-color)_42%,transparent),transparent),radial-gradient(22%_26%_at_64%_36%,color-mix(in_oklab,var(--color-primary)_14%,transparent),transparent)] motion-reduce:animate-none';
    $glowB = 'absolute -inset-1/2 animate-[markas-aurora-b_var(--markas-aurora-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(26%_22%_at_58%_62%,color-mix(in_oklab,var(--markas-aurora-color)_30%,transparent),transparent),radial-gradient(18%_22%_at_40%_60%,color-mix(in_oklab,var(--color-primary)_10%,transparent),transparent)] motion-reduce:animate-none';
    $content = 'relative';
    $colors = [
        'muted' => '[--markas-aurora-color:var(--color-muted)]',
        'primary' => '[--markas-aurora-color:var(--color-primary)]',
        'success' => '[--markas-aurora-color:var(--color-success)]',
        'warning' => '[--markas-aurora-color:var(--color-warning)]',
        'danger' => '[--markas-aurora-color:var(--color-danger)]',
    ];
    $speeds = [
        'slow' => '[--markas-aurora-speed:24s]',
        'normal' => '[--markas-aurora-speed:14s]',
        'fast' => '[--markas-aurora-speed:8s]',
    ];
    $keyframes = '@keyframes markas-aurora-a{50%{transform:translate(6%,-4%) rotate(10deg) scale(1.1)}to{transform:translate(-5%,5%) rotate(-8deg)}}@keyframes markas-aurora-b{50%{transform:translate(-7%,3%) rotate(-12deg) scale(1.15)}to{transform:translate(4%,-6%) rotate(9deg)}}';
@endphp

<div {{ $attributes->class([$base]) }}>
    <style>{!! $keyframes !!}</style>
    <div aria-hidden="true" @class([$layer, $colors[$color] ?? $colors['success'], $speeds[$speed] ?? $speeds['normal']])>
        <div class="{{ $glowA }}"></div>
        <div class="{{ $glowB }}"></div>
    </div>
    <div class="{{ $content }}">{{ $slot }}</div>
</div>
```

```blade
<x-markas.aurora-background color="success" speed="slow" class="rounded-xl border border-line bg-surface px-6 py-12">
    <h2 class="text-2xl font-semibold text-ink">Meet your calmer workspace</h2>
    <x-markas.button>Get started</x-markas.button>
</x-markas.aurora-background>
```

No JavaScript or Alpine.js needed.

### React

Save at `src/components/markas/AuroraBackground.tsx`. No extra dependencies.

```tsx
import type { ComponentProps } from "react";

const base = "relative isolate overflow-hidden";
const layer = "pointer-events-none absolute inset-0 overflow-hidden";
const glowA =
  "absolute -inset-1/2 animate-[markas-aurora-a_var(--markas-aurora-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(30%_34%_at_36%_44%,color-mix(in_oklab,var(--markas-aurora-color)_42%,transparent),transparent),radial-gradient(22%_26%_at_64%_36%,color-mix(in_oklab,var(--color-primary)_14%,transparent),transparent)] motion-reduce:animate-none";
const glowB =
  "absolute -inset-1/2 animate-[markas-aurora-b_var(--markas-aurora-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(26%_22%_at_58%_62%,color-mix(in_oklab,var(--markas-aurora-color)_30%,transparent),transparent),radial-gradient(18%_22%_at_40%_60%,color-mix(in_oklab,var(--color-primary)_10%,transparent),transparent)] motion-reduce:animate-none";
const content = "relative";
const colors = {
  muted: "[--markas-aurora-color:var(--color-muted)]",
  primary: "[--markas-aurora-color:var(--color-primary)]",
  success: "[--markas-aurora-color:var(--color-success)]",
  warning: "[--markas-aurora-color:var(--color-warning)]",
  danger: "[--markas-aurora-color:var(--color-danger)]",
};
const speeds = {
  slow: "[--markas-aurora-speed:24s]",
  normal: "[--markas-aurora-speed:14s]",
  fast: "[--markas-aurora-speed:8s]",
};
const keyframes =
  "@keyframes markas-aurora-a{50%{transform:translate(6%,-4%) rotate(10deg) scale(1.1)}to{transform:translate(-5%,5%) rotate(-8deg)}}@keyframes markas-aurora-b{50%{transform:translate(-7%,3%) rotate(-12deg) scale(1.15)}to{transform:translate(4%,-6%) rotate(9deg)}}";
const cx = (...c: (string | false | null | undefined)[]) =>
  c.filter(Boolean).join(" ");

export type AuroraBackgroundProps = ComponentProps<"div"> & {
  color?: keyof typeof colors;
  speed?: keyof typeof speeds;
};

export function AuroraBackground({
  color = "success",
  speed = "normal",
  className,
  children,
  ...props
}: AuroraBackgroundProps) {
  return (
    <div {...props} className={cx(base, className)}>
      <style>{keyframes}</style>
      <div
        aria-hidden="true"
        className={cx(layer, colors[color], speeds[speed])}
      >
        <div className={glowA} />
        <div className={glowB} />
      </div>
      <div className={content}>{children}</div>
    </div>
  );
}
```

```tsx
import { Button } from "@/components/markas/Button";
import { AuroraBackground } from "@/components/markas/AuroraBackground";

<AuroraBackground
  color="success"
  speed="slow"
  className="rounded-xl border border-line bg-surface px-6 py-12"
>
  <h2 className="text-2xl font-semibold text-ink">
    Meet your calmer workspace
  </h2>
  <Button>Get started</Button>
</AuroraBackground>;
```

### Vue

Save at `src/components/markas/AuroraBackground.vue`. No extra dependencies.

```vue
<script setup lang="ts">
const base = "relative isolate overflow-hidden";
const layer = "pointer-events-none absolute inset-0 overflow-hidden";
const glowA =
  "absolute -inset-1/2 animate-[markas-aurora-a_var(--markas-aurora-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(30%_34%_at_36%_44%,color-mix(in_oklab,var(--markas-aurora-color)_42%,transparent),transparent),radial-gradient(22%_26%_at_64%_36%,color-mix(in_oklab,var(--color-primary)_14%,transparent),transparent)] motion-reduce:animate-none";
const glowB =
  "absolute -inset-1/2 animate-[markas-aurora-b_var(--markas-aurora-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(26%_22%_at_58%_62%,color-mix(in_oklab,var(--markas-aurora-color)_30%,transparent),transparent),radial-gradient(18%_22%_at_40%_60%,color-mix(in_oklab,var(--color-primary)_10%,transparent),transparent)] motion-reduce:animate-none";
const content = "relative";
const colors = {
  muted: "[--markas-aurora-color:var(--color-muted)]",
  primary: "[--markas-aurora-color:var(--color-primary)]",
  success: "[--markas-aurora-color:var(--color-success)]",
  warning: "[--markas-aurora-color:var(--color-warning)]",
  danger: "[--markas-aurora-color:var(--color-danger)]",
};
const speeds = {
  slow: "[--markas-aurora-speed:24s]",
  normal: "[--markas-aurora-speed:14s]",
  fast: "[--markas-aurora-speed:8s]",
};
const keyframes =
  "@keyframes markas-aurora-a{50%{transform:translate(6%,-4%) rotate(10deg) scale(1.1)}to{transform:translate(-5%,5%) rotate(-8deg)}}@keyframes markas-aurora-b{50%{transform:translate(-7%,3%) rotate(-12deg) scale(1.15)}to{transform:translate(4%,-6%) rotate(9deg)}}";

const props = withDefaults(
  defineProps<{
    color?: keyof typeof colors;
    speed?: keyof typeof speeds;
  }>(),
  { color: "success", speed: "normal" },
);
</script>

<template>
  <div :class="base">
    <component :is="'style'">{{ keyframes }}</component>
    <div
      aria-hidden="true"
      :class="[layer, colors[props.color], speeds[props.speed]]"
    >
      <div :class="glowA" />
      <div :class="glowB" />
    </div>
    <div :class="content"><slot /></div>
  </div>
</template>
```

```vue
<template>
  <AuroraBackground
    color="success"
    speed="slow"
    class="rounded-xl border border-line bg-surface px-6 py-12"
  >
    <h2 class="text-2xl font-semibold text-ink">Meet your calmer workspace</h2>
    <Button>Get started</Button>
  </AuroraBackground>
</template>
```

### Svelte

Save at `src/lib/components/markas/AuroraBackground.svelte`. No extra dependencies.

```svelte
<script lang="ts">
  import type { Snippet } from "svelte";
  import type { HTMLAttributes } from "svelte/elements";

  const base = "relative isolate overflow-hidden";
  const layer = "pointer-events-none absolute inset-0 overflow-hidden";
  const glowA =
    "absolute -inset-1/2 animate-[markas-aurora-a_var(--markas-aurora-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(30%_34%_at_36%_44%,color-mix(in_oklab,var(--markas-aurora-color)_42%,transparent),transparent),radial-gradient(22%_26%_at_64%_36%,color-mix(in_oklab,var(--color-primary)_14%,transparent),transparent)] motion-reduce:animate-none";
  const glowB =
    "absolute -inset-1/2 animate-[markas-aurora-b_var(--markas-aurora-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(26%_22%_at_58%_62%,color-mix(in_oklab,var(--markas-aurora-color)_30%,transparent),transparent),radial-gradient(18%_22%_at_40%_60%,color-mix(in_oklab,var(--color-primary)_10%,transparent),transparent)] motion-reduce:animate-none";
  const content = "relative";
  const colors = {
    muted: "[--markas-aurora-color:var(--color-muted)]",
    primary: "[--markas-aurora-color:var(--color-primary)]",
    success: "[--markas-aurora-color:var(--color-success)]",
    warning: "[--markas-aurora-color:var(--color-warning)]",
    danger: "[--markas-aurora-color:var(--color-danger)]",
  };
  const speeds = {
    slow: "[--markas-aurora-speed:24s]",
    normal: "[--markas-aurora-speed:14s]",
    fast: "[--markas-aurora-speed:8s]",
  };
  const keyframes =
    "@keyframes markas-aurora-a{50%{transform:translate(6%,-4%) rotate(10deg) scale(1.1)}to{transform:translate(-5%,5%) rotate(-8deg)}}@keyframes markas-aurora-b{50%{transform:translate(-7%,3%) rotate(-12deg) scale(1.15)}to{transform:translate(4%,-6%) rotate(9deg)}}";

  type Props = HTMLAttributes<HTMLDivElement> & {
    color?: keyof typeof colors;
    speed?: keyof typeof speeds;
    children?: Snippet;
  };

  let {
    color = "success",
    speed = "normal",
    class: className,
    children,
    ...rest
  }: Props = $props();
</script>

<div {...rest} class={[base, className]}>
  {@html `<style>${keyframes}</style>`}
  <div aria-hidden="true" class={[layer, colors[color], speeds[speed]]}>
    <div class={glowA}></div>
    <div class={glowB}></div>
  </div>
  <div class={content}>{@render children?.()}</div>
</div>
```

```svelte
<script lang="ts">
  import Button from "$lib/components/markas/Button.svelte";
  import AuroraBackground from "$lib/components/markas/AuroraBackground.svelte";
</script>

<AuroraBackground
  color="success"
  speed="slow"
  class="rounded-xl border border-line bg-surface px-6 py-12"
>
  <h2 class="text-2xl font-semibold text-ink">Meet your calmer workspace</h2>
  <Button>Get started</Button>
</AuroraBackground>
```

### Astro

Save at `src/components/markas/AuroraBackground.astro`. No extra dependencies.

```astro
---
import type { HTMLAttributes } from "astro/types";

const base = "relative isolate overflow-hidden";
const layer = "pointer-events-none absolute inset-0 overflow-hidden";
const glowA =
  "absolute -inset-1/2 animate-[markas-aurora-a_var(--markas-aurora-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(30%_34%_at_36%_44%,color-mix(in_oklab,var(--markas-aurora-color)_42%,transparent),transparent),radial-gradient(22%_26%_at_64%_36%,color-mix(in_oklab,var(--color-primary)_14%,transparent),transparent)] motion-reduce:animate-none";
const glowB =
  "absolute -inset-1/2 animate-[markas-aurora-b_var(--markas-aurora-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(26%_22%_at_58%_62%,color-mix(in_oklab,var(--markas-aurora-color)_30%,transparent),transparent),radial-gradient(18%_22%_at_40%_60%,color-mix(in_oklab,var(--color-primary)_10%,transparent),transparent)] motion-reduce:animate-none";
const content = "relative";
const colors = {
  muted: "[--markas-aurora-color:var(--color-muted)]",
  primary: "[--markas-aurora-color:var(--color-primary)]",
  success: "[--markas-aurora-color:var(--color-success)]",
  warning: "[--markas-aurora-color:var(--color-warning)]",
  danger: "[--markas-aurora-color:var(--color-danger)]",
};
const speeds = {
  slow: "[--markas-aurora-speed:24s]",
  normal: "[--markas-aurora-speed:14s]",
  fast: "[--markas-aurora-speed:8s]",
};
const keyframes =
  "@keyframes markas-aurora-a{50%{transform:translate(6%,-4%) rotate(10deg) scale(1.1)}to{transform:translate(-5%,5%) rotate(-8deg)}}@keyframes markas-aurora-b{50%{transform:translate(-7%,3%) rotate(-12deg) scale(1.15)}to{transform:translate(4%,-6%) rotate(9deg)}}";

type Props = HTMLAttributes<"div"> & {
  color?: keyof typeof colors;
  speed?: keyof typeof speeds;
};

const {
  color = "success",
  speed = "normal",
  class: className,
  ...rest
} = Astro.props;
---

<div {...rest} class:list={[base, className]}>
  <style is:inline set:html={keyframes} />
  <div aria-hidden="true" class:list={[layer, colors[color], speeds[speed]]}>
    <div class={glowA}></div>
    <div class={glowB}></div>
  </div>
  <div class={content}><slot /></div>
</div>
```

```astro
---
import Button from "@/components/markas/Button.astro";
import AuroraBackground from "@/components/markas/AuroraBackground.astro";
---

<AuroraBackground
  color="success"
  speed="slow"
  class="rounded-xl border border-line bg-surface px-6 py-12"
>
  <h2 class="text-2xl font-semibold text-ink">
    Meet your calmer workspace
  </h2>
  <Button>Get started</Button>
</AuroraBackground>
```

No client-side JavaScript; the markup is rendered on the server.

### Angular

Save at `src/app/markas/aurora-background.component.ts`. No extra dependencies.

```ts
import {
  ChangeDetectionStrategy,
  Component,
  computed,
  input,
  ViewEncapsulation,
} from "@angular/core";

const base = "relative isolate overflow-hidden";
const layer = "pointer-events-none absolute inset-0 overflow-hidden";
const glowA =
  "absolute -inset-1/2 animate-[markas-aurora-a_var(--markas-aurora-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(30%_34%_at_36%_44%,color-mix(in_oklab,var(--markas-aurora-color)_42%,transparent),transparent),radial-gradient(22%_26%_at_64%_36%,color-mix(in_oklab,var(--color-primary)_14%,transparent),transparent)] motion-reduce:animate-none";
const glowB =
  "absolute -inset-1/2 animate-[markas-aurora-b_var(--markas-aurora-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(26%_22%_at_58%_62%,color-mix(in_oklab,var(--markas-aurora-color)_30%,transparent),transparent),radial-gradient(18%_22%_at_40%_60%,color-mix(in_oklab,var(--color-primary)_10%,transparent),transparent)] motion-reduce:animate-none";
const content = "relative";
const colors = {
  muted: "[--markas-aurora-color:var(--color-muted)]",
  primary: "[--markas-aurora-color:var(--color-primary)]",
  success: "[--markas-aurora-color:var(--color-success)]",
  warning: "[--markas-aurora-color:var(--color-warning)]",
  danger: "[--markas-aurora-color:var(--color-danger)]",
};
const speeds = {
  slow: "[--markas-aurora-speed:24s]",
  normal: "[--markas-aurora-speed:14s]",
  fast: "[--markas-aurora-speed:8s]",
};
const keyframes =
  "@keyframes markas-aurora-a{50%{transform:translate(6%,-4%) rotate(10deg) scale(1.1)}to{transform:translate(-5%,5%) rotate(-8deg)}}@keyframes markas-aurora-b{50%{transform:translate(-7%,3%) rotate(-12deg) scale(1.15)}to{transform:translate(4%,-6%) rotate(9deg)}}";

export type AuroraBackgroundColor = keyof typeof colors;
export type AuroraBackgroundSpeed = keyof typeof speeds;

/**
 * Attribute selector on a native div: the user's class, style, and attributes stay on the
 * root. The keyframes are a global style, so encapsulation is off.
 */
@Component({
  selector: "div[markas-aurora-background]",
  changeDetection: ChangeDetectionStrategy.OnPush,
  encapsulation: ViewEncapsulation.None,
  styles: [keyframes],
  host: { "[class]": "base" },
  template: `
    <div aria-hidden="true" [class]="layerClasses()">
      <div [class]="glowA"></div>
      <div [class]="glowB"></div>
    </div>
    <div [class]="content"><ng-content /></div>
  `,
})
export class AuroraBackground {
  readonly color = input<AuroraBackgroundColor>("success");
  readonly speed = input<AuroraBackgroundSpeed>("normal");

  protected readonly base = base;
  protected readonly glowA = glowA;
  protected readonly glowB = glowB;
  protected readonly content = content;
  protected readonly layerClasses = computed(
    () => `${layer} ${colors[this.color()]} ${speeds[this.speed()]}`,
  );
}
```

```ts
import { Component } from "@angular/core";
import { Button } from "./markas/button.component";
import { AuroraBackground } from "./markas/aurora-background.component";

@Component({
  selector: "app-hero",
  imports: [Button, AuroraBackground],
  template: `
    <div
      markas-aurora-background
      color="success"
      speed="slow"
      class="rounded-xl border border-line bg-surface px-6 py-12"
    >
      <h2 class="text-2xl font-semibold text-ink">
        Meet your calmer workspace
      </h2>
      <button markas-button>Get started</button>
    </div>
  `,
})
export class Hero {}
```

The component is an attribute on a div, so class, style, and other attributes stay on the root element.

## Props

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `color` | `muted \| primary \| success \| warning \| danger` | success | Accent token mixed with primary in the glow. |
| `speed` | `slow \| normal \| fast` | normal | How fast the glow drifts: 24s, 14s, or 8s per cycle. |
| `children / slot` | `slot / ReactNode / snippet` | - | Content shown on top of the glow. |

## Accessibility

- The glow layer is aria-hidden and ignores pointer events.
- With reduced motion, the glow stops moving and stays in its starting position.
- The glow is light enough that ink and muted text keep their contrast.

## Notes

- The glow mixes `primary` with the `color` token, so it follows light and dark mode.
- Keyframes ship inside the component in a small `<style>` tag. With reduced motion the glow stays still.
- The component has no built-in text, so there are no label props to translate.
