---
title: "Screensaver"
description: "Shows any scene after the page has no input for a while, over the page or one box. The first key or press wakes it and does not reach the page."
url: https://gelatinui.com/components/screensaver
markdown_url: https://gelatinui.com/components/screensaver.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/screensaver"
version: "2026-11-11"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Screensaver

> Shows any scene after the page has no input for a while, over the page or one box. The first key or press wakes it and does not reach the page.

Page: https://gelatinui.com/components/screensaver

## When to use it

Best for: A scene that covers the page or one box after no input, and goes on the first key or press.

- Use it on a kiosk, a lobby display, or a wall screen that people leave alone for a long time.
- Use `container="parent"` to fill one box (a display tile) instead of the whole page.
- Use `disabled` and a `ScreensaverTrigger` when only a button must start it.

## When not to use it

- For a modal task that takes focus, use a [Dialog](https://gelatinui.com/components/dialog.md).
- For a moving background that is always on, use a scene alone, such as [Starfield](https://gelatinui.com/components/starfield.md).

## Notes for agents

- Put a scene (Bounce, Starfield, Ribbons, Pipes, or any node) in `ScreensaverScene` inside `ScreensaverOverlay`.
- `container="parent"` needs a positioned box with its own corners (`relative`, `overflow-hidden`).
- The waking key and press never reach the page, and focus never moves.
- `timeout` is in ms (default 60000); `active` and `onActiveChange` control it.
- `useScreensaver()` gives `active`, `start`, and `stop` to a part of your own.

## Anatomy

```text
Screensaver
├─ ScreensaverOverlay (0..n)
├─ ScreensaverScene (0..n)
├─ ScreensaverHint (0..n)
└─ ScreensaverTrigger (0..n)
```

## API reference

### Screensaver

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `timeout` | `number` | 60_000 | How long the page must have no input before it shows, in ms. Default 60 000 (1 minute). |
| `active` | `boolean` |  | Shown or not (controlled). The machine still asks through `onActiveChange`. |
| `defaultActive` | `boolean` | false | Shown at first (uncontrolled). Default false. |
| `onActiveChange` | `function` |  | Called when the idle timer, a wake, or the Trigger shows or hides it. |
| `disabled` | `boolean` | false | Stops the idle timer. The Trigger and `active` still show it. |
| `children` | `ReactNode` |  |  |

### ScreensaverOverlay

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `container` | `"page" \| "parent"` | "page" | `page` (default): fixed over the whole page, in a portal on `document.body`. `parent`: fills the nearest positioned box (give it `relative` and its corners). |

### ScreensaverScene

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `seed` | `number` | 1 | The random look of the scene: the same seed draws the same start. Default 1. |

### ScreensaverHint

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `hideAfter` | `number \| false` | HINT_HIDE_AFTER | When the hint fades out, in ms after it shows; `false` keeps it. Default 3000. |

### ScreensaverTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| ScreensaverOverlay | `screensaver-overlay` |  |  |  |
| ScreensaverScene | `screensaver-scene` |  |  |  |
| ScreensaverHint | `screensaver-hint` |  |  |  |
| ScreensaverTrigger | `screensaver-trigger` |  |  |  |

## Usage

Wrap the page or a box in `Screensaver`, and put a scene in the overlay.

The sample also uses `bounce`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui-pro/screensaver @gelatin-ui-pro/bounce
```

```tsx title="lobby-screensaver.tsx"
import { Bounce } from "@/components/pro/screensavers/bounce";
import {
  Screensaver,
  ScreensaverHint,
  ScreensaverOverlay,
  ScreensaverScene,
} from "@/components/pro/screensavers/screensaver";

export function LobbyScreensaver() {
  return (
    <Screensaver timeout={60_000}>
      <ScreensaverOverlay>
        <ScreensaverScene>
          <Bounce>
            <img key="logo" src="/logo.png" alt="" width={160} height={48} />
          </Bounce>
        </ScreensaverScene>
        <ScreensaverHint />
      </ScreensaverOverlay>
    </Screensaver>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/screensaver
```

It adds 28 registry items: 25 files, 3379 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [Portal](https://gelatinui.com/components/portal.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Bounce](https://gelatinui.com/components/bounce.md)
- [Starfield](https://gelatinui.com/components/starfield.md)
- [Ribbons](https://gelatinui.com/components/ribbons.md)
- [Pipes](https://gelatinui.com/components/pipes.md)
- [Clock](https://gelatinui.com/components/clock.md)
- [Dialog](https://gelatinui.com/components/dialog.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Any key | Wakes it. The key does not reach the focused field. |

## Accessibility

The overlay is decoration: it takes no focus, and focus stays where it was.

A key, a press, a wheel, a focus move, or a mouse move of 8px or more wakes it.

In `container="parent"`, a key is stopped only when focus is in the box or on the page body.

## Motion

| Part | Motion |
| --- | --- |
| Show | theme · 450ms · the overlay fades in |
| Wake | overlay-exit · 150ms · the overlay fades out |
| Hint | fade · the hint fades in, and fades out after 3 seconds |
