Lewati ke konten
MarkasUI
Ketik untuk mencari

    Panduan

    MarkasUI

    Form

    Feedback

    Overlay

    Navigasi

    Data

    Section

    Animasi

    Latar

    Tombol

    Template

    Halaman

    Pixel Trail

    Grid sel kecil yang menyala di bawah kursor lalu memudar, digambar di satu canvas. Fokus keyboard menyalakan sel di sekitar elemen yang difokus.

    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";
    }

    Contoh

    Kartu ajakan dengan titik

    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.

    Area coret dengan kuas lembut

    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.

    Strip navbar dengan cahaya fokus

    Instalasi

    npx markasui@latest add pixel-trail

    Pemakaian

    <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">Pembayaran yang terasa instan</h1>
    </x-markas.pixel-trail>

    Butuh 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">Pembayaran yang terasa instan</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">Pembayaran yang terasa instan</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>

    Satu script kecil yang dibundel menggambar setiap canvas lewat elemen markas-pixel-trail.

    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 {}
    • Sel digambar di satu canvas di belakang konten, jadi ribuan sel pun tidak menambah node DOM. Canvas hanya menggambar ulang selama masih ada sel yang menyala.
    • variant: persegi pixel, lingkaran dot, atau brush yang juga menyalakan sel di sekitarnya dengan lebih lembut. Gerakan cepat diisi, sehingga jejak tidak berlubang.
    • Saat elemen di dalamnya mendapat fokus keyboard, sel di sekitarnya menyala. autoplay menggambar jejak sendiri selama area terlihat dan kursor di tempat lain.
    • Warna dibaca dari token tema, sehingga mengikuti mode gelap. Dengan reduced motion tidak ada yang digambar. Atribut dan class jatuh ke area.

    Props

    NamaTipeDefaultKeterangan
    variant"pixel" | "dot" | "brush""pixel"pixel: sel persegi. dot: sel bulat seperti papan LED. brush: kuas lembut yang juga menyalakan sel di sekitar kursor.
    cellSizenumber24Sisi satu sel dalam px.
    fadenumber600Lama sel yang menyala memudar, dalam ms.
    color"primary" | "success" | "warning" | "danger" | "ink""primary"Token warna cahaya, dibaca dari tema sehingga mengikuti mode terang dan gelap.
    showGridbooleanfalseMenggambar garis grid tipis di antara sel.
    autoplaybooleanfalseMenggambar jejak sendiri selama area terlihat, tab aktif, dan kursor di tempat lain.
    children / slotReactNode / slot-Konten di atas sel. Atur tata letaknya dengan class sendiri pada komponen.

    Aksesibilitas

    • Canvas bersifat aria-hidden dan tidak menangkap pointer; konten di atasnya tetap terbaca dan bisa diklik.
    • Saat elemen di dalamnya mendapat fokus keyboard, sel di sekitarnya menyala sebagai penanda fokus tambahan di samping cincin fokus biasa.
    • Dengan reduced motion tidak ada yang digambar; canvas hanya menggambar ulang selama masih ada sel yang menyala.

    Komponen terkait

    Komponen markasui lain dengan class yang sama di setiap framework.