Skip to content
MarkasUI
Type to search

    Guide

    MarkasUI

    Form

    Feedback

    Overlay

    Navigation

    Data

    Sections

    Animations

    Backgrounds

    Buttons

    Templates

    Pages

    Pixel Trail

    Grid of small cells that light up under the pointer and fade out, drawn on one canvas. Keyboard focus lights the cells around the focused element.

    Interfaces that answer the pointer

    Move across the grid and leave a trail.

    Interfaces that answer the pointer

    Move across the grid and leave a trail.

    Interfaces that answer the pointer

    Move across the grid and leave a trail.

    Interfaces that answer the pointer

    Move across the grid and leave a trail.

    Interfaces that answer the pointer

    Move across the grid and leave a trail.

    @php
        $hero = 'grid h-72 content-center justify-items-center gap-3 rounded-xl border border-line bg-surface p-6 text-center';
        $title = 'max-w-72 text-2xl font-semibold text-ink';
        $text = 'text-sm text-muted';
    @endphp
    
    <x-markas.pixel-trail show-grid :class="$hero">
        <h3 class="{{ $title }}">Interfaces that answer the pointer</h3>
        <p class="{{ $text }}">Move across the grid and leave a trail.</p>
        <x-markas.button>Get started</x-markas.button>
    </x-markas.pixel-trail>
    import { Button } from "@/components/markas/Button";
    import { PixelTrail } from "@/components/markas/PixelTrail";
    
    const hero =
      "grid h-72 content-center justify-items-center gap-3 rounded-xl border border-line bg-surface p-6 text-center";
    const title = "max-w-72 text-2xl font-semibold text-ink";
    const text = "text-sm text-muted";
    
    export default function PixelTrailExample() {
      return (
        <PixelTrail showGrid className={hero}>
          <h3 className={title}>Interfaces that answer the pointer</h3>
          <p className={text}>Move across the grid and leave a trail.</p>
          <Button>Get started</Button>
        </PixelTrail>
      );
    }
    <script setup lang="ts">
    import Button from "@/components/markas/Button.vue";
    import PixelTrail from "@/components/markas/PixelTrail.vue";
    
    const hero =
      "grid h-72 content-center justify-items-center gap-3 rounded-xl border border-line bg-surface p-6 text-center";
    const title = "max-w-72 text-2xl font-semibold text-ink";
    const text = "text-sm text-muted";
    </script>
    
    <template>
      <PixelTrail show-grid :class="hero">
        <h3 :class="title">Interfaces that answer the pointer</h3>
        <p :class="text">Move across the grid and leave a trail.</p>
        <Button>Get started</Button>
      </PixelTrail>
    </template>
    <script lang="ts">
      import Button from "$lib/components/markas/Button.svelte";
      import PixelTrail from "$lib/components/markas/PixelTrail.svelte";
    
      const hero =
        "grid h-72 content-center justify-items-center gap-3 rounded-xl border border-line bg-surface p-6 text-center";
      const title = "max-w-72 text-2xl font-semibold text-ink";
      const text = "text-sm text-muted";
    </script>
    
    <PixelTrail showGrid class={hero}>
      <h3 class={title}>Interfaces that answer the pointer</h3>
      <p class={text}>Move across the grid and leave a trail.</p>
      <Button>Get started</Button>
    </PixelTrail>
    ---
    import Button from "@/components/markas/Button.astro";
    import PixelTrail from "@/components/markas/PixelTrail.astro";
    
    const hero =
      "grid h-72 content-center justify-items-center gap-3 rounded-xl border border-line bg-surface p-6 text-center";
    const title = "max-w-72 text-2xl font-semibold text-ink";
    const text = "text-sm text-muted";
    ---
    
      <PixelTrail showGrid class={hero}>
        <h3 class={title}>Interfaces that answer the pointer</h3>
        <p class={text}>Move across the grid and leave a trail.</p>
        <Button>Get started</Button>
      </PixelTrail>
    import { Component } from "@angular/core";
    import { Button } from "./markas/button.component";
    import { PixelTrail } from "./markas/pixel-trail.component";
    
    @Component({
      selector: "markas-example",
      imports: [Button, PixelTrail],
      template: `
        <markas-pixel-trail showGrid [class]="hero">
          <h3 [class]="title">Interfaces that answer the pointer</h3>
          <p [class]="text">Move across the grid and leave a trail.</p>
          <button markas-button>Get started</button>
        </markas-pixel-trail>
      `,
    })
    export default class PixelTrailExample {
      protected readonly hero =
        "grid h-72 content-center justify-items-center gap-3 rounded-xl border border-line bg-surface p-6 text-center";
      protected readonly title = "max-w-72 text-2xl font-semibold text-ink";
      protected readonly text = "text-sm text-muted";
    }

    Examples

    Call to action card with dots

    Join 4,000 teams across Indonesia

    Free for 14 days, then from Rp 49.000 a month.

    Join 4,000 teams across Indonesia

    Free for 14 days, then from Rp 49.000 a month.

    Join 4,000 teams across Indonesia

    Free for 14 days, then from Rp 49.000 a month.

    Join 4,000 teams across Indonesia

    Free for 14 days, then from Rp 49.000 a month.

    Join 4,000 teams across Indonesia

    Free for 14 days, then from Rp 49.000 a month.

    Sketch pad with a soft brush

    Sketch pad

    Draw with your cursor. It doodles on its own too.

    Sketch pad

    Draw with your cursor. It doodles on its own too.

    Sketch pad

    Draw with your cursor. It doodles on its own too.

    Sketch pad

    Draw with your cursor. It doodles on its own too.

    Sketch pad

    Draw with your cursor. It doodles on its own too.

    Navbar strip with focus glow

    Installation

    npx markasui@latest add pixel-trail

    Usage

    <x-markas.pixel-trail variant="dot" color="success" :cell-size="16" :fade="900" show-grid class="grid h-80 place-items-center rounded-xl bg-surface">
        <h1 class="text-4xl font-semibold">Payments that feel instant</h1>
    </x-markas.pixel-trail>

    Needs Alpine.js.

    import { PixelTrail } from "@/components/markas/PixelTrail";
    
    <PixelTrail
      variant="dot"
      color="success"
      cellSize={16}
      fade={900}
      showGrid
      className="grid h-80 place-items-center rounded-xl bg-surface"
    >
      <h1 className="text-4xl font-semibold">Payments that feel instant</h1>
    </PixelTrail>;
    <template>
      <PixelTrail
        variant="dot"
        color="success"
        :cell-size="16"
        :fade="900"
        show-grid
        class="grid h-80 place-items-center rounded-xl bg-surface"
      >
        <h1 class="text-4xl font-semibold">Payments that feel instant</h1>
      </PixelTrail>
    </template>
    <script lang="ts">
      import PixelTrail from "$lib/components/markas/PixelTrail.svelte";
    </script>
    
    <PixelTrail
      variant="dot"
      showGrid
      class="grid h-64 place-items-center rounded-xl"
    >
      <h2 class="text-2xl font-semibold">Move your mouse</h2>
    </PixelTrail>
    ---
    import PixelTrail from "@/components/markas/PixelTrail.astro";
    ---
    
    <PixelTrail variant="dot" showGrid class="grid h-64 place-items-center rounded-xl">
      <h2 class="text-2xl font-semibold">Move your mouse</h2>
    </PixelTrail>

    A small bundled script draws each canvas through the markas-pixel-trail element.

    import { Component } from "@angular/core";
    import { PixelTrail } from "./markas/pixel-trail.component";
    
    @Component({
      selector: "app-hero",
      imports: [PixelTrail],
      template: `
        <markas-pixel-trail
          variant="dot"
          showGrid
          class="grid h-64 place-items-center rounded-xl"
        >
          <h2 class="text-2xl font-semibold">Move your mouse</h2>
        </markas-pixel-trail>
      `,
    })
    export class Hero {}
    • Cells are drawn on one canvas behind the content, so even thousands of cells cost no DOM nodes. The canvas only redraws while some cell is still lit.
    • variant: pixel squares, dot circles, or brush, which also lights the neighbours more softly. Fast moves are filled in, so the trail has no gaps.
    • When an element inside gets keyboard focus, the cells around it light up. autoplay draws a trail of its own while the area is on screen and the pointer is elsewhere.
    • The color is read from the theme token, so it follows dark mode. With reduced motion nothing is drawn. Attributes and class go to the area.

    Props

    NameTypeDefaultDescription
    variant"pixel" | "dot" | "brush""pixel"pixel: square cells. dot: round cells like an LED board. brush: a soft brush that also lights the cells around the pointer.
    cellSizenumber24Side of one cell in px.
    fadenumber600How long a lit cell takes to fade out, in ms.
    color"primary" | "success" | "warning" | "danger" | "ink""primary"Light color token, read from the theme so it follows light and dark mode.
    showGridbooleanfalseDraws faint grid lines between the cells.
    autoplaybooleanfalseDraws a trail on its own while the area is on screen, the tab is visible, and the pointer is elsewhere.
    children / slotReactNode / slot-Content shown above the cells. Lay it out with your own classes on the component.

    Accessibility

    • The canvas is aria-hidden and never catches the pointer; content above it stays readable and clickable.
    • When an element inside gets keyboard focus, the cells around it light up as an extra focus cue next to the normal focus ring.
    • With reduced motion nothing is drawn; the canvas only redraws while some cell is still lit.

    Related components

    More markasui components with the same classes in every framework.