Lewati ke konten
MarkasUI
Ketik untuk mencari

    Panduan

    MarkasUI

    Form

    Feedback

    Overlay

    Navigasi

    Data

    Section

    Animasi

    Latar

    Tombol

    Template

    Halaman

    Screensaver

    Area tempat satu atau beberapa elemen memantul di dinding seperti screensaver DVD lama, berganti token warna atau memipih di setiap benturan.

    Page not found

    The link may be old, or the page moved somewhere else.

    Page not found

    The link may be old, or the page moved somewhere else.

    Page not found

    The link may be old, or the page moved somewhere else.

    Page not found

    The link may be old, or the page moved somewhere else.

    Page not found

    The link may be old, or the page moved somewhere else.

    @php
        $card = 'rounded-xl border border-line bg-surface p-5 text-center';
        $area = 'h-44 rounded-lg bg-subtle';
        $logo = 'flex items-center gap-2 text-3xl font-bold tabular-nums';
        $icon = 'size-8';
        $title = 'mt-5 text-base font-semibold text-ink';
        $text = 'mt-1 text-sm text-muted';
        $action = 'mt-4';
    @endphp
    
        <div class="{{ $card }}">
          <x-markas.screensaver :class="$area" aria-hidden="true">
            <span class="{{ $logo }}"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="{{ $icon }}"><path d="M4 6h16v12H4z"></path><path d="m4 6 8 6 8-6"></path></svg>404</span>
          </x-markas.screensaver>
          <p class="{{ $title }}">Page not found</p>
          <p class="{{ $text }}">The link may be old, or the page moved somewhere else.</p>
          <x-markas.button :class="$action">Back to home</x-markas.button>
        </div>
    import { Screensaver } from "@/components/markas/Screensaver";
    import { Button } from "@/components/markas/Button";
    
    const card = "rounded-xl border border-line bg-surface p-5 text-center";
    const area = "h-44 rounded-lg bg-subtle";
    const logo = "flex items-center gap-2 text-3xl font-bold tabular-nums";
    const icon = "size-8";
    const title = "mt-5 text-base font-semibold text-ink";
    const text = "mt-1 text-sm text-muted";
    const action = "mt-4";
    
    export default function ScreensaverExample() {
      return (
        <div className={card}>
          <Screensaver className={area} aria-hidden="true">
            <span className={logo}>
              <svg
                viewBox="0 0 24 24"
                fill="none"
                stroke="currentColor"
                strokeWidth="1.5"
                strokeLinecap="round"
                strokeLinejoin="round"
                aria-hidden="true"
                className={icon}
              >
                <path d="M4 6h16v12H4z"></path>
                <path d="m4 6 8 6 8-6"></path>
              </svg>
              404
            </span>
          </Screensaver>
          <p className={title}>Page not found</p>
          <p className={text}>
            The link may be old, or the page moved somewhere else.
          </p>
          <Button className={action}>Back to home</Button>
        </div>
      );
    }
    <script setup lang="ts">
    import Screensaver from "@/components/markas/Screensaver.vue";
    import Button from "@/components/markas/Button.vue";
    
    const card = "rounded-xl border border-line bg-surface p-5 text-center";
    const area = "h-44 rounded-lg bg-subtle";
    const logo = "flex items-center gap-2 text-3xl font-bold tabular-nums";
    const icon = "size-8";
    const title = "mt-5 text-base font-semibold text-ink";
    const text = "mt-1 text-sm text-muted";
    const action = "mt-4";
    </script>
    
    <template>
      <div :class="card">
        <Screensaver :class="area" aria-hidden="true">
          <span :class="logo"
            ><svg
              viewBox="0 0 24 24"
              fill="none"
              stroke="currentColor"
              stroke-width="1.5"
              stroke-linecap="round"
              stroke-linejoin="round"
              aria-hidden="true"
              :class="icon"
            >
              <path d="M4 6h16v12H4z"></path>
              <path d="m4 6 8 6 8-6"></path></svg
            >404</span
          >
        </Screensaver>
        <p :class="title">Page not found</p>
        <p :class="text">The link may be old, or the page moved somewhere else.</p>
        <Button :class="action">Back to home</Button>
      </div>
    </template>
    <script lang="ts">
      import Screensaver from "$lib/components/markas/Screensaver.svelte";
      import Button from "$lib/components/markas/Button.svelte";
    
      const card = "rounded-xl border border-line bg-surface p-5 text-center";
      const area = "h-44 rounded-lg bg-subtle";
      const logo = "flex items-center gap-2 text-3xl font-bold tabular-nums";
      const icon = "size-8";
      const title = "mt-5 text-base font-semibold text-ink";
      const text = "mt-1 text-sm text-muted";
      const action = "mt-4";
    </script>
    
    <div class={card}>
      <Screensaver class={area} aria-hidden="true">
        <span class={logo}
          ><svg
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            stroke-width="1.5"
            stroke-linecap="round"
            stroke-linejoin="round"
            aria-hidden="true"
            class={icon}
          >
            <path d="M4 6h16v12H4z"></path>
            <path d="m4 6 8 6 8-6"></path></svg
          >404</span
        >
      </Screensaver>
      <p class={title}>Page not found</p>
      <p class={text}>The link may be old, or the page moved somewhere else.</p>
      <Button class={action}>Back to home</Button>
    </div>
    ---
    import Screensaver from "@/components/markas/Screensaver.astro";
    import Button from "@/components/markas/Button.astro";
    
    const card = "rounded-xl border border-line bg-surface p-5 text-center";
    const area = "h-44 rounded-lg bg-subtle";
    const logo = "flex items-center gap-2 text-3xl font-bold tabular-nums";
    const icon = "size-8";
    const title = "mt-5 text-base font-semibold text-ink";
    const text = "mt-1 text-sm text-muted";
    const action = "mt-4";
    ---
    
      <div class={card}>
        <Screensaver class={area} aria-hidden="true">
          <span class={logo}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class={icon}>
              <path d="M4 6h16v12H4z"></path>
              <path d="m4 6 8 6 8-6"></path></svg>404</span>
        </Screensaver>
        <p class={title}>Page not found</p>
        <p class={text}>The link may be old, or the page moved somewhere else.</p>
        <Button class={action}>Back to home</Button>
      </div>
    import { Component } from "@angular/core";
    import { Screensaver } from "./markas/screensaver.component";
    import { Button } from "./markas/button.component";
    
    @Component({
      selector: "markas-example",
      imports: [Screensaver, Button],
      template: `
        <div [class]="card">
          <markas-screensaver [class]="area" aria-hidden="true">
            <span [class]="logo"
              ><svg
                viewBox="0 0 24 24"
                fill="none"
                stroke="currentColor"
                stroke-width="1.5"
                stroke-linecap="round"
                stroke-linejoin="round"
                aria-hidden="true"
                [class]="icon"
              >
                <path d="M4 6h16v12H4z"></path>
                <path d="m4 6 8 6 8-6"></path></svg
              >404</span
            >
          </markas-screensaver>
          <p [class]="title">Page not found</p>
          <p [class]="text">
            The link may be old, or the page moved somewhere else.
          </p>
          <button markas-button [class]="action">Back to home</button>
        </div>
      `,
    })
    export default class ScreensaverExample {
      protected readonly card =
        "rounded-xl border border-line bg-surface p-5 text-center";
      protected readonly area = "h-44 rounded-lg bg-subtle";
      protected readonly logo =
        "flex items-center gap-2 text-3xl font-bold tabular-nums";
      protected readonly icon = "size-8";
      protected readonly title = "mt-5 text-base font-semibold text-ink";
      protected readonly text = "mt-1 text-sm text-muted";
      protected readonly action = "mt-4";
    }

    Contoh

    Empty state dengan kotak yang memipih

    No orders yet

    When customers check out, their orders show up here.

    No orders yet

    When customers check out, their orders show up here.

    No orders yet

    When customers check out, their orders show up here.

    No orders yet

    When customers check out, their orders show up here.

    No orders yet

    When customers check out, their orders show up here.

    Beberapa orang memantul sekaligus

    Online now

    4 people

    Rania Putri Bima Saputra Sekar Ayu Dimas Pratama

    Online now

    4 people

    Rania PutriBima SaputraSekar AyuDimas Pratama

    Online now

    4 people

    Rania PutriBima SaputraSekar AyuDimas Pratama

    Online now

    4 people

    Rania Putri Bima Saputra Sekar Ayu Dimas Pratama

    Online now

    4 people

    Rania PutriBima SaputraSekar AyuDimas Pratama

    Banner peluncuran tipis

    Launching 17 August
    Launching 17 August
    Launching 17 August
    Launching 17 August
    Launching 17 August

    Instalasi

    npx markasui@latest add screensaver

    Pemakaian

    <x-markas.screensaver class="h-44 rounded-lg bg-subtle" aria-hidden="true">
        <span class="flex items-center gap-2 text-3xl font-bold">
            <svg class="size-8" aria-hidden="true">...</svg>404
        </span>
    </x-markas.screensaver>

    Butuh Alpine.js.

    import { Screensaver } from "@/components/markas/Screensaver";
    
    <Screensaver
      effect="squash"
      speed={50}
      className="h-32 w-36 rounded-lg bg-subtle"
      aria-hidden="true"
    >
      <span className="grid size-12 place-items-center rounded-xl bg-surface">
        ...
      </span>
    </Screensaver>;
    <template>
      <Screensaver
        :speed="60"
        :tones="['success', 'warning']"
        class="h-52 rounded-lg bg-canvas"
      >
        <span class="flex items-center gap-2 rounded-full bg-surface px-3 py-1">
          <span class="size-2.5 rounded-full bg-current"></span>
          <span class="text-ink">Rania Putri</span>
        </span>
      </Screensaver>
    </template>
    <script lang="ts">
      import Screensaver from "$lib/components/markas/Screensaver.svelte";
    </script>
    
    <Screensaver class="h-56 rounded-xl border border-line" aria-hidden="true">
      <span class="text-3xl font-bold">Markas</span>
    </Screensaver>
    ---
    import Screensaver from "@/components/markas/Screensaver.astro";
    ---
    
    <Screensaver class="h-56 rounded-xl border border-line" aria-hidden="true">
      <span class="text-3xl font-bold">Markas</span>
    </Screensaver>

    Satu script kecil yang dibundel menjalankan setiap area lewat elemen markas-screensaver.

    import { Component } from "@angular/core";
    import { Screensaver } from "./markas/screensaver.component";
    
    @Component({
      selector: "app-idle",
      imports: [Screensaver],
      template: `
        <markas-screensaver
          effect="squash"
          class="h-56 rounded-xl border border-line"
          aria-hidden="true"
        >
          <span class="text-3xl font-bold">Markas</span>
        </markas-screensaver>
      `,
    })
    export class Idle {}
    • Setiap anak langsung mulai di posisi seed dan memantul di dinding dengan kecepatan speed px per detik. Beri area tinggi.
    • effect="tone" memindahkan setiap elemen ke token berikutnya di tones pada setiap benturan; warnai bagian yang ikut berubah dengan currentColor (misalnya bg-current atau stroke SVG). effect="squash" membuatnya memipih dan memanjang, "none" hanya memantul.
    • Gerakan berhenti saat area di luar layar, tab tersembunyi, ada yang difokus di dalamnya, atau (dengan pauseOnHover) kursor berada di atasnya.
    • Dengan reduced motion setiap elemen diam di posisi seed dengan tone pertamanya.

    Props

    NamaTipeDefaultKeterangan
    speednumber80Kecepatan gerak dalam px per detik. 40 sampai 60 terasa santai, 120 ke atas terasa ramai.
    effect"tone" | "squash" | "none""tone"Yang terjadi di setiap benturan dinding: pindah ke token warna berikutnya, memipih dan memanjang seperti bola karet, atau tidak ada.
    tones("primary" | "success" | "warning" | "danger" | "ink" | "muted")[]["primary", "success", "warning", "danger"]Token warna yang diputar oleh efek tone. Setiap elemen mulai dengan tone-nya sendiri; beri gaya currentColor pada bagian yang ikut berubah.
    seednumber1Mengubah posisi dan arah awal. Seed yang sama selalu menghasilkan awal yang sama.
    pauseOnHoverbooleantrueMenghentikan gerakan saat kursor berada di atas area.
    children / slotReactNode / slot-Elemen yang memantul. Setiap anak langsung bergerak sendiri. Beri area tinggi, misalnya h-44.

    Aksesibilitas

    • Gerakan hanya berjalan saat area terlihat di layar dan tab aktif, dan berhenti saat ada yang memegang fokus keyboard di dalamnya.
    • Tandai area yang murni dekoratif dengan aria-hidden="true"; teks di dalam elemen yang memantul tetap dibaca seperti biasa.
    • Dengan reduced motion setiap elemen diam di posisi seed dengan tone pertamanya.

    Komponen terkait

    Komponen markasui lain dengan class yang sama di setiap framework.