Skip to content
MarkasUI
Type to search

    Guide

    MarkasUI

    Form

    Feedback

    Overlay

    Navigation

    Data

    Sections

    Animations

    Backgrounds

    Buttons

    Templates

    Pages

    Screensaver

    Area where one or more elements bounce off the walls like an old DVD screensaver, switching color tokens or squashing on each hit.

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

    Examples

    Empty state with a squashing box

    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.

    Several people bouncing at once

    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

    Slim launch banner

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

    Installation

    npx markasui@latest add screensaver

    Usage

    <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>

    Needs 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>

    A small bundled script runs each area through the markas-screensaver element.

    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 {}
    • Each direct child starts at a seeded spot and bounces off the walls at speed px per second. Give the area a height.
    • effect="tone" switches each element to the next token in tones on every wall hit; color the parts that should change with currentColor (such as bg-current or an SVG stroke). effect="squash" squashes and stretches instead, "none" just bounces.
    • Motion pauses while the area is off screen, the tab is hidden, something inside has focus, or (with pauseOnHover) the pointer is over it.
    • With reduced motion every element rests at its seeded spot in its first tone.

    Props

    NameTypeDefaultDescription
    speednumber80Travel speed in px per second. 40 to 60 feels lazy, 120 and up feels busy.
    effect"tone" | "squash" | "none""tone"What happens on each wall hit: switch to the next color token, squash and stretch like a rubber ball, or nothing.
    tones("primary" | "success" | "warning" | "danger" | "ink" | "muted")[]["primary", "success", "warning", "danger"]Color tokens the tone effect cycles through. Each element starts on its own tone; style the parts that should change with currentColor.
    seednumber1Changes the starting spots and directions. The same seed always gives the same start.
    pauseOnHoverbooleantrueStops the motion while the pointer is over the area.
    children / slotReactNode / slot-The bouncing elements. Each direct child moves on its own. Give the area a height, such as h-44.

    Accessibility

    • Motion runs only while the area is on screen and the tab is visible, and stops while anything inside has keyboard focus.
    • Mark a purely decorative area with aria-hidden="true"; text inside a bouncing element is otherwise read as usual.
    • With reduced motion each element rests at its seeded spot in its first tone.

    Related components

    More markasui components with the same classes in every framework.